lkml.org 
[lkml]   [2018]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch V2 16/28] 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 <tglx@linutronix.de>

    ---
    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
    @@ -257,15 +257,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);
    }

    @@ -309,11 +303,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;
    }


    \
     
     \ /
      Last update: 2018-11-25 19:59    [W:2.826 / U:0.132 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site