Skip to contentSkip to conversation

x86: sparse warning in cpufreq/powernow-k8.c

PATCH In review Harvey Harrison 1 participant 2 messages Feb 7, 2008 1 message not in the archive x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 x86: sparse warning in cpufreq/powernow-k8.c

Nested per_cpu accessors will shadow the internal __ptr variable. Use a temporary first_core variable.

arch/x86/kernel/cpu/cpufreq/powernow-k8.c:1239:9: warning: symbol '__ptr' shadows an earlier one arch/x86/kernel/cpu/cpufreq/powernow-k8.c:1239:9: originally declared here

---
 arch/x86/kernel/cpu/cpufreq/powernow-k8.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +2 -1
index 5affe91..e64eee0 100644
@@ -1234,9 +1234,10 @@ static unsigned int powernowk8_get (unsigned int cpu)
 {
 	struct powernow_k8_data *data;
 	cpumask_t oldmask = current->cpus_allowed;
+	unsigned int first_core = first_cpu(per_cpu(cpu_core_map, cpu));
 	unsigned int khz = 0;
 
-	data = per_cpu(powernow_data, first_cpu(per_cpu(cpu_core_map, cpu)));
+	data = per_cpu(powernow_data, first_core);
 
 	if (!data)
 		return -EINVAL;
Signature · 1 line
1.5.4.1189.g38fd5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · Dave Jones
Quoted 3 lines · Harvey Harrison

Nested per_cpu accessors will shadow the internal __ptr variable. Use a temporary first_core variable.

Quoted 9 lines
Quoted 4 lines

arch/x86/kernel/cpu/cpufreq/powernow-k8.c:1239:9: warning: symbol '__ptr' shadows an earlier one arch/x86/kernel/cpu/cpufreq/powernow-k8.c:1239:9: originally declared here

Already fixed in cpufreq.git

(Please also Cc me on cpufreq patches, thanks)

Sorry about that, I've been sending Ingo a bunch of x86 patches, didn't think to look further than that. Will keep in mind.

Harvey