[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c15a558ae3a3e6837f9eb157201f87b2e0f219a4.camel@perches.com>
Date: Mon, 02 Feb 2026 21:57:50 -0800
From: Joe Perches <joe@...ches.com>
To: Nam Cao <namcao@...utronix.de>, Andy Whitcroft <apw@...onical.com>,
Dwaipayan Ray <dwaipayanray1@...il.com>, Lukas Bulwahn
<lukas.bulwahn@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: Checkpatch false positive: externs should be avoided in .c files
On Mon, 2026-02-02 at 13:05 +0100, Nam Cao wrote:
> Hi,
>
> checkpatch seems to give a wrong warning about this patch:
> https://lore.kernel.org/linux-riscv/20260202115403.2119218-1-namcao@linutronix.de/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?
Please use the more common style like:
atomic_t __section(".sdata") hart_lottery;
---
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index b5bc5fc65cea..c89cc272440b 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -46,11 +46,7 @@
* This is used before the kernel initializes the BSS so it can't be in the
* BSS.
*/
-atomic_t hart_lottery __section(".sdata")
-#ifdef CONFIG_XIP_KERNEL
-= ATOMIC_INIT(0xC001BEEF)
-#endif
-;
+atomic_t hart_lottery __section(".sdata");
unsigned long boot_cpu_hartid;
EXPORT_SYMBOL_GPL(boot_cpu_hartid);
Powered by blists - more mailing lists