x86/cpu: Do the feature test first in enable_sep_cpu()
authorBorislav Petkov <[email protected]>
Wed, 16 Mar 2016 12:19:29 +0000 (13:19 +0100)
committerIngo Molnar <[email protected]>
Tue, 29 Mar 2016 10:57:12 +0000 (12:57 +0200)
... before assigning local vars. Kill out label too and simplify.

No functionality change.

Signed-off-by: Borislav Petkov <[email protected]>
Acked-by: Andy Lutomirski <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/cpu/common.c

index 8394b3d1f94fca21913fb27c2e7432e343006b64..7fea4079d1020c306a6c6c3d6cf1da32ec856e50 100644 (file)
@@ -1076,12 +1076,12 @@ void enable_sep_cpu(void)
        struct tss_struct *tss;
        int cpu;
 
+       if (!boot_cpu_has(X86_FEATURE_SEP))
+               return;
+
        cpu = get_cpu();
        tss = &per_cpu(cpu_tss, cpu);
 
-       if (!boot_cpu_has(X86_FEATURE_SEP))
-               goto out;
-
        /*
         * We cache MSR_IA32_SYSENTER_CS's value in the TSS's ss1 field --
         * see the big comment in struct x86_hw_tss's definition.
@@ -1096,7 +1096,6 @@ void enable_sep_cpu(void)
 
        wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0);
 
-out:
        put_cpu();
 }
 #endif