Re: [PATCH v4 3/8] x86/mce: Make four functions return bool

From: Sohil Mehta
Date: Mon Nov 11 2024 - 21:33:25 EST


On 11/10/2024 10:04 PM, Qiuxu Zhuo wrote:
> Make those functions whose callers only care about success or failure
> return a boolean value for better readability. Also, update the call
> sites accordingly.
>
> No functional changes.
>
> Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>
> ---

Reviewed-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>

> Changes in v4:
> - New patch.
>
> arch/x86/kernel/cpu/mce/core.c | 12 ++++++------
> arch/x86/kernel/cpu/mce/genpool.c | 29 ++++++++++++++---------------
> arch/x86/kernel/cpu/mce/internal.h | 4 ++--
> 3 files changed, 22 insertions(+), 23 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index 167965bd2ac0..ce6fe5e20805 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -151,7 +151,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(injectm);
>
> void mce_log(struct mce_hw_err *err)
> {
> - if (!mce_gen_pool_add(err))
> + if (mce_gen_pool_add(err))
> irq_work_queue(&mce_irq_work);
> }

The polarities of all the return values have been flipped. They all look
correct but took me a few minutes to figure out. Might be useful to make
a mention in the commit message if you end up doing another version (Not
needed otherwise).

> EXPORT_SYMBOL_GPL(mce_log);