From: Thomas Gleixner <t...@linutronix.de> commit 495d470e9828500e0155027f230449ac5e29c025 upstream.
There is no point in having two functions and a conditional at the call site. Signed-off-by: Thomas Gleixner <t...@linutronix.de> Reviewed-by: Ingo Molnar <mi...@kernel.org> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Andy Lutomirski <l...@kernel.org> Cc: Linus Torvalds <torva...@linux-foundation.org> Cc: Jiri Kosina <jkos...@suse.cz> Cc: Tom Lendacky <thomas.lenda...@amd.com> Cc: Josh Poimboeuf <jpoim...@redhat.com> Cc: Andrea Arcangeli <aarca...@redhat.com> Cc: David Woodhouse <d...@amazon.co.uk> Cc: Tim Chen <tim.c.c...@linux.intel.com> Cc: Andi Kleen <a...@linux.intel.com> Cc: Dave Hansen <dave.han...@intel.com> Cc: Casey Schaufler <casey.schauf...@intel.com> Cc: Asit Mallick <asit.k.mall...@intel.com> Cc: Arjan van de Ven <ar...@linux.intel.com> Cc: Jon Masters <j...@redhat.com> Cc: Waiman Long <longman9...@gmail.com> Cc: Greg KH <gre...@linuxfoundation.org> Cc: Dave Stewart <david.c.stew...@intel.com> Cc: Kees Cook <keesc...@chromium.org> Link: https://lkml.kernel.org/r/20181125185004.986890...@linutronix.de Signed-off-by: Ben Hutchings <b...@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- arch/x86/kernel/cpu/bugs.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -249,15 +249,9 @@ static const struct { { "auto", SPECTRE_V2_CMD_AUTO, false }, }; -static void __init spec2_print_if_insecure(const char *reason) +static void __init spec_v2_print_cond(const char *reason, bool secure) { - if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) - pr_info("%s selected on command line.\n", reason); -} - -static void __init spec2_print_if_secure(const char *reason) -{ - if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) + if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2) != secure) pr_info("%s selected on command line.\n", reason); } @@ -305,11 +299,8 @@ static enum spectre_v2_mitigation_cmd __ return SPECTRE_V2_CMD_AUTO; } - if (mitigation_options[i].secure) - spec2_print_if_secure(mitigation_options[i].option); - else - spec2_print_if_insecure(mitigation_options[i].option); - + spec_v2_print_cond(mitigation_options[i].option, + mitigation_options[i].secure); return cmd; }