init_intel reads MSR_IA32_MISC_ENABLE with rdmsr() macro into un unsigned int pair (l1 and l2).
Only l1 is used and compared with MSR_IA32_MISC_ENABLE_BTS_UNAVAIL and
MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (both ULL). Because l2 is never used,
this caused a -Wunused-but-set-variable warning under W=1:
arch/x86/kernel/cpu/intel.c: In function ‘init_intel’:
arch/x86/kernel/cpu/intel.c:554:34: warning: variable ‘l2’ set but not used [-Wunused-but-set-variable=]
554 | unsigned int l1, l2;
It was replaced with rdmsrq() to read full 64-bit value directly into u64 variable,
and compared with the masks. Dropping the low/high (l1, l2) variables.
No functional change intended.
Signed-off-by: Vojtěch Krátký <vo.kratky@seznam.cz>
---
arch/x86/kernel/cpu/intel.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index f28c0efb7c8f..d5e1ecc7baed 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -551,12 +551,12 @@ static void init_intel(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
if (boot_cpu_has(X86_FEATURE_DS)) {
- unsigned int l1, l2;
+ u64 val;
- rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
- if (!(l1 & MSR_IA32_MISC_ENABLE_BTS_UNAVAIL))
+ rdmsrq(MSR_IA32_MISC_ENABLE, val);
+ if (!(val & MSR_IA32_MISC_ENABLE_BTS_UNAVAIL))
set_cpu_cap(c, X86_FEATURE_BTS);
- if (!(l1 & MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL))
+ if (!(val & MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL))
set_cpu_cap(c, X86_FEATURE_PEBS);
}
--
2.54.0