Re: [PATCH] mm/kmemleak: fix errors/warnings for coding style

From: Pintu Agarwal
Date: Thu Oct 17 2024 - 13:23:54 EST


Hi Catalin,

On Thu, 17 Oct 2024 at 15:10, Catalin Marinas <catalin.marinas@xxxxxxx> wrote:
>
> On Tue, Oct 15, 2024 at 12:09:18AM +0530, Pintu Kumar wrote:
> > There are several errors/warnings reported by checkpatch.
> > Fix all of the positive once as below:
> > - Use #include <linux/processor.h> instead of <asm/processor.h>
> > - Missing a blank lines after declarations
> > - Prefer 'unsigned int' to bare use of 'unsigned'
> > - else should follow close brace '}'
>
> I wouldn't bother fixing up the style in existing code, it just makes
> backporting fixes harder.
>
Thank you so much for your review.
Yes, I agree but I see that this keeps growing.
In 5.15 kernel there were 10 warnings:
total: 0 errors, 10 warnings, 2010 lines checked

But now in the 6.12 kernel it becomes 20.
total: 1 errors, 20 warnings, 2253 lines checked

This means new warnings were introduced while the old ones still remain.
Thus I thought it's better to reduce it.

> > @@ -2179,8 +2180,7 @@ static int __init kmemleak_boot_config(char *str)
> > else if (strcmp(str, "on") == 0) {
> > kmemleak_skip_disable = 1;
> > stack_depot_request_early_init();
> > - }
> > - else
> > + } else
> > return -EINVAL;
> > return 0;
>
> According to the coding style doc, the 'else' branch also needs braces
> here.
Oh yes, thanks for pointing this out.
Unfortunately checkpatch does not report this.
But I tried adding braces and no issues either.
I will push the new patchset with this change.

Thanks,
Pintu