Skip to contentSkip to conversation

x86: common: fix unused variable warning

PATCH New zhong jiang 2 participants 2 messages Sep 13, 2018 – Sep 22, 2018 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: common: fix unused variable warning

Fix the following compile warning:

rch/x86/kernel/cpu/common.c: In function 'syscall_init':
arch/x86/kernel/cpu/common.c:1534:6: warning: unused variable 'cpu' [-Wunused-variable]
int cpu = smp_processor_id();

---
 arch/x86/kernel/cpu/common.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/common.c +2 -3
index 0e3e803..0b283e5 100644
@@ -1531,8 +1531,6 @@ static __init int setup_clearcpuid(char *arg)
 /* May not be marked __init: used by software suspend */
 void syscall_init(void)
 {
-	int cpu = smp_processor_id();
-
 	wrmsr(MSR_STAR, 0, (__USER32_CS << 16) | __KERNEL_CS);
 	wrmsrl(MSR_LSTAR, (unsigned long)entry_SYSCALL_64);
 
@@ -1545,7 +1543,8 @@ void syscall_init(void)
 	 * AMD doesn't allow SYSENTER in long mode (either 32- or 64-bit).
 	 */
 	wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
-	wrmsrl_safe(MSR_IA32_SYSENTER_ESP, (unsigned long)(cpu_entry_stack(cpu) + 1));
+	wrmsrl_safe(MSR_IA32_SYSENTER_ESP,
+		    (unsigned long)(cpu_entry_stack(smp_processor_id()) + 1));
 	wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat);
 #else
 	wrmsrl(MSR_CSTAR, (unsigned long)ignore_sysret);
Signature · 1 line
1.7.12.4
#1 lore raw

[tip:x86/pti] x86/CPU: Fix unused variable warning when !CONFIG_IA32_EMULATION

x86/CPU: Fix unused variable warning when !CONFIG_IA32_EMULATION
Commit-ID:  8e6b65a1b6cd1711d3acd2aa5c60d38c3e15dabb
Gitweb:     https://git.kernel.org/tip/8e6b65a1b6cd1711d3acd2aa5c60d38c3e15dabb
Author:     zhong jiang <[email protected]>
AuthorDate: Thu, 13 Sep 2018 10:49:45 +0800
Committer:  Borislav Petkov <[email protected]>
CommitDate: Sat, 15 Sep 2018 14:57:05 +0200

x86/CPU: Fix unused variable warning when !CONFIG_IA32_EMULATION

Get rid of local @cpu variable which is unused in the !CONFIG_IA32_EMULATION case.

Cc Andy Lutomirski <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Pavel Tatashin <[email protected]>
Cc x86-ml <[email protected]>
[ Clean up commit message. ]
---
 arch/x86/kernel/cpu/common.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/common.c +2 -3
index 2d5b1fa5f9c6..8bffeae9bac2 100644
@@ -1531,8 +1531,6 @@ EXPORT_PER_CPU_SYMBOL(__preempt_count);
 /* May not be marked __init: used by software suspend */
 void syscall_init(void)
 {
-	int __maybe_unused cpu = smp_processor_id();
-
 	wrmsr(MSR_STAR, 0, (__USER32_CS << 16) | __KERNEL_CS);
 	wrmsrl(MSR_LSTAR, (unsigned long)entry_SYSCALL_64);
 
@@ -1545,7 +1543,8 @@ void syscall_init(void)
 	 * AMD doesn't allow SYSENTER in long mode (either 32- or 64-bit).
 	 */
 	wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
-	wrmsrl_safe(MSR_IA32_SYSENTER_ESP, (unsigned long)(cpu_entry_stack(cpu) + 1));
+	wrmsrl_safe(MSR_IA32_SYSENTER_ESP,
+		    (unsigned long)(cpu_entry_stack(smp_processor_id()) + 1));
 	wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat);
 #else
 	wrmsrl(MSR_CSTAR, (unsigned long)ignore_sysret);