x86: cpu/intel_cacheinfo.c fix compilation warnings
PATCH 1/1 x86: cpu/intel_cacheinfo.c fix compilation warnings
fix:
arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘show_cache_disable’:
arch/x86/kernel/cpu/intel_cacheinfo.c:712: warning: unused variable ‘node’ arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘store_cache_disable’:
arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’
--- arch/x86/kernel/cpu/intel_cacheinfo.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/intel_cacheinfo.c +9 -7
@@ -708,14 +708,15 @@ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf)static ssize_t show_cache_disable (struct _cpuid4_info *this_leaf,char *buf,unsigned int index) { -int cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); -int node =cpu_to_node (cpu); -struct pci_dev *dev =node_to_k8_nb_misc (node); +struct pci_dev *dev;unsigned int reg =0 ; +int cpu;if (!this_leaf->can_disable)return -EINVAL ; + cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); + dev =node_to_k8_nb_misc (cpu_to_node (cpu));if (!dev)return -EINVAL ;
@@ -735,11 +736,10 @@ SHOW_CACHE_DISABLE(1)static ssize_t store_cache_disable (struct _cpuid4_info *this_leaf,const char *buf,size_t count,unsigned int index) { -int cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); -int node =cpu_to_node (cpu); -struct pci_dev *dev =node_to_k8_nb_misc (node); -unsigned long val =0 ; +struct pci_dev *dev;unsigned int scrubber =0 ; +unsigned long val =0 ; +int cpu;if (!this_leaf->can_disable)return -EINVAL ;
@@ -747,6 +747,8 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,if (!capable (CAP_SYS_ADMIN ))return -EPERM ; + cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); + dev =node_to_k8_nb_misc (cpu_to_node (cpu));if (!dev)return -EINVAL ;
Signature · 1 line
1.6.0.6
Quoted 5 lines · Jaswinder Singh Rajput
fix:
arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘show_cache_disable’:
arch/x86/kernel/cpu/intel_cacheinfo.c:712: warning: unused variable ‘node’arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘store_cache_disable’:
arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’
you again 'fixed' a warning.
this made you fail to analyze and miss the real reason for this for example:
Review
Quoted 3 lines
arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’(quoted diff) +0
-1- int node = cpu_to_node(cpu);
the local variable is clearly initialized.
The problem is not with that variable - the problem is most likely with the cpu_to_node() macro not creating a reference to the 'cpu' variable in a compiler-visible way, in the !NUMA case.
The typical way to solve this is to add a dummy:
(void)(cpu)
use to the 'cpu' parameter to the macro definition - or, (which is a much better solution), to convert it to an inline function.
Ingo
Quoted 23 lines · Ingo Molnar
Quoted 5 lines · Jaswinder Singh Rajput
fix:
arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘show_cache_disable’:
arch/x86/kernel/cpu/intel_cacheinfo.c:712: warning: unused variable ‘node’arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘store_cache_disable’:
arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’you again 'fixed' a warning.
this made you fail to analyze and miss the real reason for this for example:
Review
Quoted 3 lines
arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’(quoted diff) +0
-1- int node = cpu_to_node(cpu);the local variable is clearly initialized.
The problem is not with that variable - the problem is most likely with the
cpu_to_node()macro not creating a reference to the 'cpu' variable in a compiler-visible way, in the !NUMA case.
Quoted 7 lines
The typical way to solve this is to add a dummy:
(void)(cpu)use to the 'cpu' parameter to the macro definition - or, (which is a much better solution), to convert it to an inline function.
OK send patch:
[PATCH -tip] x86: k8.h reference to node in node_to_k8_nb_misc for !CONFIG_K8_NB
Thanks,
--
JSR
Quoted 26 lines · Jaswinder Singh Rajput
Quoted 25 lines · Ingo Molnar
Quoted 5 lines · Jaswinder Singh Rajput
fix:
arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘show_cache_disable’:
arch/x86/kernel/cpu/intel_cacheinfo.c:712: warning: unused variable ‘node’arch/x86/kernel/cpu/intel_cacheinfo.c: In function ‘store_cache_disable’:
arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’you again 'fixed' a warning.
this made you fail to analyze and miss the real reason for this for example:
Review
Quoted 3 lines
arch/x86/kernel/cpu/intel_cacheinfo.c:739: warning: unused variable ‘node’(quoted diff) +0
-1- int node = cpu_to_node(cpu);the local variable is clearly initialized.
The problem is not with that variable - the problem is most likely with the
cpu_to_node()macro not creating a reference to the 'cpu' variable in a compiler-visible way, in the !NUMA case.The typical way to solve this is to add a dummy:
Quoted 8 lines
Quoted 5 lines
(void)(cpu)use to the 'cpu' parameter to the macro definition - or, (which is a much better solution), to convert it to an inline function.
OK send patch:
[PATCH -tip] x86:k8.hreference to node innode_to_k8_nb_miscfor !CONFIG_K8_NB
You sent a patch, but did you read+understand the
suggestions i made above?
Ingo