Re: [PATCH v3 05/10] x86/mce/genpool: Make mce_gen_pool_create() return explicit error codes
From: Borislav Petkov
Date: Sat Nov 02 2024 - 09:15:26 EST
On Fri, Oct 25, 2024 at 10:45:57AM +0800, Qiuxu Zhuo wrote:
> mce_numrecords = max(MCE_MIN_ENTRIES, num_possible_cpus() * MCE_PER_CPU);
> mce_poolsz = mce_numrecords * (1 << order);
> mce_pool = kmalloc(mce_poolsz, GFP_KERNEL);
> if (!mce_pool) {
> gen_pool_destroy(gpool);
> - return ret;
> + return -ENOMEM;
This patch is just silly: the function is not that huge not to be able to see
at a quick glance that it is -ENOMEM that is being returned in all error cases
...
> }
> ret = gen_pool_add(gpool, (unsigned long)mce_pool, mce_poolsz, -1);
> if (ret) {
... except in this case where, oh well, actually, it is -ENOMEM again but you
have to go down the bowells of genalloc to see it.
All in all, this is causing more churn than actually improving something...
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette