lkml.org 
[lkml]   [2023]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v4 6/6] x86/microcode/intel: Print when early microcode loading fails
    From
    On 1/9/23 07:35, Ashok Raj wrote:
    > -static void print_ucode(int old_rev, int new_rev, int date)
    > +static void print_ucode(bool failed, int old_rev, int new_rev, int date)
    ...
    > if (rev != mc->hdr.rev)
    > - return -1;
    > + retval = -1;
    >
    > uci->cpu_sig.rev = rev;
    >
    > if (early)
    > - print_ucode(old_rev, uci->cpu_sig.rev, mc->hdr.date);
    > + print_ucode(retval, old_rev, mc->hdr.rev, mc->hdr.date);
    > else
    > - print_ucode_info(old_rev, uci->cpu_sig.rev, mc->hdr.date);
    > + print_ucode_info(retval, old_rev, uci->cpu_sig.rev, mc->hdr.date);
    >
    > - return 0;
    > + return retval;
    > }

    I'm generally not a _huge_ fan of having an 'int' implicitly cast to a
    bool. The:

    print_ucode_info(retval, ...

    Line could be right or wrong based on what the retval is logically.
    This, on the other hand:

    bool failed = false;
    ...
    if (rev != mc->hdr.rev) {
    retval = -1;
    failed = true;
    }
    ...
    print_ucode_info(failed, old_rev, uci->cpu_sig.rev, ...

    *Clearly* and unambiguously matches up with:

    static void print_ucode(bool failed, int old_rev, ...


    \
     
     \ /
      Last update: 2023-03-26 23:44    [W:3.330 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site