From 49cbef7749a35e005370f0498a5906a4cb042935 Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 3 Dec 2019 22:26:55 +0000 Subject: [PATCH] cpufreq_dt: Do not fetch again hw.ncpu MD code already set the global variable mp_ncpus according to the tunable hw.ncpu so use the global variable directly. Reported by: ian --- sys/dev/cpufreq/cpufreq_dt.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/dev/cpufreq/cpufreq_dt.c b/sys/dev/cpufreq/cpufreq_dt.c index 061345f1bfca..f6a9ec3f756d 100644 --- a/sys/dev/cpufreq/cpufreq_dt.c +++ b/sys/dev/cpufreq/cpufreq_dt.c @@ -446,7 +446,7 @@ cpufreq_dt_attach(device_t dev) struct cpufreq_dt_softc *sc; phandle_t node; phandle_t cnode, opp, copp; - int cpu, ncpu; + int cpu; uint64_t freq; int rv = 0; enum opp_version version; @@ -456,11 +456,9 @@ cpufreq_dt_attach(device_t dev) node = ofw_bus_get_node(device_get_parent(dev)); cpu = device_get_unit(device_get_parent(dev)); - if (TUNABLE_INT_FETCH("hw.ncpu", &ncpu)) { - if (cpu >= ncpu) { - device_printf(dev, "Not attaching as cpu is not present\n"); - return (ENXIO); - } + if (cpu >= mp_ncpus) { + device_printf(dev, "Not attaching as cpu is not present\n"); + return (ENXIO); } if (regulator_get_by_ofw_property(dev, node,