Skip to content

Commit 495d470

Browse files
committed
x86/speculation: Unify conditional spectre v2 print functions
There is no point in having two functions and a conditional at the call site. Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Tom Lendacky <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Tim Chen <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Casey Schaufler <[email protected]> Cc: Asit Mallick <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: Jon Masters <[email protected]> Cc: Waiman Long <[email protected]> Cc: Greg KH <[email protected]> Cc: Dave Stewart <[email protected]> Cc: Kees Cook <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 30ba72a commit 495d470

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,9 @@ static const struct {
257257
{ "auto", SPECTRE_V2_CMD_AUTO, false },
258258
};
259259

260-
static void __init spec2_print_if_insecure(const char *reason)
260+
static void __init spec_v2_print_cond(const char *reason, bool secure)
261261
{
262-
if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
263-
pr_info("%s selected on command line.\n", reason);
264-
}
265-
266-
static void __init spec2_print_if_secure(const char *reason)
267-
{
268-
if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
262+
if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2) != secure)
269263
pr_info("%s selected on command line.\n", reason);
270264
}
271265

@@ -309,11 +303,8 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
309303
return SPECTRE_V2_CMD_AUTO;
310304
}
311305

312-
if (mitigation_options[i].secure)
313-
spec2_print_if_secure(mitigation_options[i].option);
314-
else
315-
spec2_print_if_insecure(mitigation_options[i].option);
316-
306+
spec_v2_print_cond(mitigation_options[i].option,
307+
mitigation_options[i].secure);
317308
return cmd;
318309
}
319310

0 commit comments

Comments
 (0)