From: Borislav Petkov (AMD) Date: Tue, 30 Jul 2024 07:52:43 +0000 (+0200) Subject: x86/microcode/AMD: Fix a -Wsometimes-uninitialized clang false positive X-Git-Tag: v6.12-rc1~228^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5343558a868e7e635b40baa2e46bf53df1a2d131;p=thirdparty%2Fkernel%2Flinux.git x86/microcode/AMD: Fix a -Wsometimes-uninitialized clang false positive Initialize equiv_id in order to shut up: arch/x86/kernel/cpu/microcode/amd.c:714:6: warning: variable 'equiv_id' is \ used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (x86_family(bsp_cpuid_1_eax) < 0x17) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ because clang doesn't do interprocedural analysis for warnings to see that this variable won't be used uninitialized. Fixes: 94838d230a6c ("x86/microcode/AMD: Use the family,model,stepping encoded in the patch ID") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202407291815.gJBST0P3-lkp@intel.com/ Signed-off-by: Borislav Petkov (AMD) --- diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 1f5d36f92b8a2..f63b051f25a0a 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -703,7 +703,7 @@ static struct ucode_patch *find_patch(unsigned int cpu) { struct ucode_cpu_info *uci = ucode_cpu_info + cpu; u32 rev, dummy __always_unused; - u16 equiv_id; + u16 equiv_id = 0; /* fetch rev if not populated yet: */ if (!uci->cpu_sig.rev) {