powernow: don't read never initialized structure member
authorJan Beulich <jbeulich@suse.com>
Mon, 7 Nov 2011 09:26:23 +0000 (10:26 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 7 Nov 2011 09:26:23 +0000 (10:26 +0100)
c/s 20361:51b031b0737e removed the writing of struct
processor_performance's shared_cpu_map member, but the powernow driver
still has code to read it (though presumably that code path can't be
taken on actual hardware supported by the powernow driver). Remove the
use of the field along with the field itself.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/acpi/cpufreq/powernow.c
xen/include/acpi/cpufreq/processor_perf.h

index 846f9ca8e99da4c8d374e6071785c283f3083cd2..4f94d3f7266b0283b7805a8de28c42811450aa4b 100644 (file)
@@ -200,15 +200,17 @@ static int powernow_cpufreq_cpu_init(struct cpufreq_policy *policy)
     perf = data->acpi_data;
     policy->shared_type = perf->shared_type;
 
-    /*
-     * Will let policy->cpus know about dependency only when software
-     * coordination is required.
-     */
     if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
         policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
-        policy->cpus = perf->shared_cpu_map;
+        cpumask_set_cpu(cpu, &policy->cpus);
+        if (cpumask_weight(&policy->cpus) != 1) {
+            printk(XENLOG_WARNING "Unsupported sharing type %d (%u CPUs)\n",
+                   policy->shared_type, cpumask_weight(&policy->cpus));
+            result = -ENODEV;
+            goto err_unreg;
+        }
     } else {
-        policy->cpus = cpumask_of_cpu(cpu);    
+        cpumask_copy(&policy->cpus, cpumask_of(cpu));
     }
 
     /* capability check */
index b909796e1a0e4708827b4037930146a7a730442e..d8a1ba68a6bd4aa43c9486ca2dc80dc320592105 100644 (file)
@@ -29,7 +29,6 @@ struct processor_performance {
     uint32_t state_count;
     struct xen_processor_px *states;
     struct xen_psd_package domain_info;
-    cpumask_t shared_cpu_map;
     uint32_t shared_type;
 
     uint32_t init;