All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/kernel: remove unneeded dead-store initialization
@ 2021-03-31  8:00 Yang Li
  2021-03-31 17:49 ` Nick Desaulniers
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yang Li @ 2021-03-31  8:00 UTC (permalink / raw)
  To: tglx
  Cc: mingo, bp, x86, hpa, nathan, ndesaulniers, linux-kernel,
	clang-built-linux, Yang Li

make clang-analyzer on x86_64 defconfig caught my attention with:

arch/x86/kernel/cpu/cacheinfo.c:880:24: warning: Value stored to
'this_cpu_ci' during its initialization is never read
[clang-analyzer-deadcode.DeadStores]
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
^

So, simply remove this unneeded dead-store initialization to make
clang-analyzer happy.

As compilers will detect this unneeded assignment and optimize this anyway,
the resulting object code is identical before and after this change.

No functional change. No change to object code.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 arch/x86/kernel/cpu/cacheinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
index 3ca9be4..d66af29 100644
--- a/arch/x86/kernel/cpu/cacheinfo.c
+++ b/arch/x86/kernel/cpu/cacheinfo.c
@@ -877,7 +877,7 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 static int __cache_amd_cpumap_setup(unsigned int cpu, int index,
 				    struct _cpuid4_info_regs *base)
 {
-	struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
+	struct cpu_cacheinfo *this_cpu_ci;
 	struct cacheinfo *this_leaf;
 	int i, sibling;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-07 21:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  8:00 [PATCH] x86/kernel: remove unneeded dead-store initialization Yang Li
2021-03-31 17:49 ` Nick Desaulniers
2021-04-07 12:02 ` Borislav Petkov
2021-04-07 17:41   ` Nick Desaulniers
2021-04-07 19:03     ` Borislav Petkov
2021-04-07 19:07       ` Borislav Petkov
2021-04-07 21:31         ` Nick Desaulniers
2021-04-07 19:22 ` [tip: x86/cleanups] x86/cacheinfo: Remove " tip-bot2 for Yang Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.