Re: Checkpatch false positive: externs should be avoided in .c files
From: Joe Perches
Date: Mon Feb 02 2026 - 10:25:03 EST
On Mon, 2026-02-02 at 13:05 +0100, Nam Cao wrote:
> Hi,
Hi Nam.
I was very confused for a second.
I have a friend with your name.
He's not someone who would use checkpatch.
I'll look at it.
cheers, Joe
> checkpatch seems to give a wrong warning about this patch:
> https://lore.kernel.org/linux-riscv/20260202115403.2119218-1-namcao@xxxxxxxxxxxxx/T/#u
>
> WARNING: externs should be avoided in .c files
> #663: FILE: arch/riscv/kernel/setup.c:49:
> +atomic_t hart_lottery __section(".sdata");
>
> I think this is wrong, because 'extern' does not even appear anywhere in
> that part of the diff.
>
> I attempted to look into checkpatch, but my perl knowledge is not
> sufficient to dig deeper into this issue. Can you please have a look?
>
> Best regards,
> Nam