Skip to contentSkip to conversation

x86/cacheinfo: Remove set but unused variable 'trace'

PATCH In review Jiapeng Chong 2 participants 2 messages Nov 23, 2022 – Dec 2, 2022 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cacheinfo: Remove set but unused variable 'trace'

Variable 'trace' is not effectively used in the function, so delete it.

arch/x86/kernel/cpu/cacheinfo.c:737:15: warning: variable 'trace' set but not used.

---
 arch/x86/kernel/cpu/cacheinfo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/cacheinfo.c +1 -2
index f4e5aa27eec6..c6c0052def8e 100644
@@ -734,7 +734,7 @@ void init_hygon_cacheinfo(struct cpuinfo_x86 *c)
 void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 {
 	/* Cache sizes */
-	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0;
+	unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0;
 	unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
 	unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
 	unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
@@ -836,7 +836,6 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 							l3 += cache_table[k].size;
 							break;
 						case LVL_TRACE:
-							trace += cache_table[k].size;
 							break;
 						}
 
Signature · 1 line
2.20.1.7.g153144c
#1 lore raw
Quoted 5 lines · Jiapeng Chong

Variable 'trace' is not effectively used in the function, so delete it.

arch/x86/kernel/cpu/cacheinfo.c:737:15: warning: variable 'trace' set but not used.

This link is really pointless.

Quoted 20 lines
---
 arch/x86/kernel/cpu/cacheinfo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/cacheinfo.c +1 -1
index f4e5aa27eec6..c6c0052def8e 100644
@@ -734,7 +734,7 @@ void init_hygon_cacheinfo(struct cpuinfo_x86 *c)
 void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 {
 	/* Cache sizes */
-	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0;
+	unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0;
 	unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
 	unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
 	unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;

arch/x86/kernel/cpu/cacheinfo.c void init_intel_cacheinfo(struct cpuinfo_x86 *c) · line 839

Quoted 5 lines
arch/x86/kernel/cpu/cacheinfo.c +0 -1
@@ -836,7 +836,6 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 							l3 += cache_table[k].size;
 							break;
 						case LVL_TRACE:
-							trace += cache_table[k].size;
 							break;

Sure, that makes the warning go away, but what's the purpose of 'case LVL_TRACE:' now?

Now if you remove that you really want look at the surrounding logic of LVL_TRACE. Hint: There is way more completely useless code to remove.

Thanks,

tglx