* [PATCH] x86/cacheinfo: Remove set but unused variable 'trace'
@ 2022-11-23 6:01 Jiapeng Chong
2022-12-02 13:04 ` Thomas Gleixner
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2022-11-23 6:01 UTC (permalink / raw)
To: tglx
Cc: mingo, bp, dave.hansen, x86, hpa, linux-kernel, Jiapeng Chong,
Abaci Robot
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.
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3243
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
arch/x86/kernel/cpu/cacheinfo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
index f4e5aa27eec6..c6c0052def8e 100644
--- a/arch/x86/kernel/cpu/cacheinfo.c
+++ b/arch/x86/kernel/cpu/cacheinfo.c
@@ -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;
}
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/cacheinfo: Remove set but unused variable 'trace'
2022-11-23 6:01 [PATCH] x86/cacheinfo: Remove set but unused variable 'trace' Jiapeng Chong
@ 2022-12-02 13:04 ` Thomas Gleixner
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2022-12-02 13:04 UTC (permalink / raw)
To: Jiapeng Chong
Cc: mingo, bp, dave.hansen, x86, hpa, linux-kernel, Jiapeng Chong,
Abaci Robot
On Wed, Nov 23 2022 at 14:01, Jiapeng Chong wrote:
> 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.
>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3243
This link is really pointless.
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> arch/x86/kernel/cpu/cacheinfo.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
> index f4e5aa27eec6..c6c0052def8e 100644
> --- a/arch/x86/kernel/cpu/cacheinfo.c
> +++ b/arch/x86/kernel/cpu/cacheinfo.c
> @@ -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;
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-02 13:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23 6:01 [PATCH] x86/cacheinfo: Remove set but unused variable 'trace' Jiapeng Chong
2022-12-02 13:04 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox