Re: [PATCH 1/5] x86/cpu: Introduce new microcode matching helper

From: Dave Hansen
Date: Fri Dec 13 2024 - 12:56:04 EST


On 12/9/24 21:46, Chao Gao wrote:
>> +bool x86_match_min_microcode_rev(const struct x86_cpu_id *table)
>> +{
>> + const struct x86_cpu_id *res = x86_match_cpu(table);
>> +
>> + if (!res || res->driver_data > boot_cpu_data.microcode)
>> + return false;
>> +
>> + return true;
> Maybe we can simplify the logic to:
>
> return res && res->driver_data <= boot_cpu_data.microcode;

So, yeah, it can be made shorter.

But it's 100% a style thing and I'm not at all in the camp of fewer
lines meaning better code. It's all short enough to see without even
really moving your eyeballs so it's short _enough_ for sure. There's
only one line of real logic either way.