warning: cast removes address space '__percpu' of expression

From: Charlemagne Lasse
Date: Fri Mar 29 2024 - 19:57:13 EST


After switching to linux 6.9-rc1, I get a lot of these errors (when
compiling with cgcc/sparse):

/include/linux/netdevice.h:4033:17: warning: cast removes address
space '__percpu' of expression

This is around code which wasn't changed and which correctly uses the
per cpu helper. Sparse flags were -Wsparse-all for sparse 0.6.4
(latest release). Sparse was enabled via C=1 parameter and sparse was
configured using CHECK="sparse -Wsparse-all"

Problem was introduced between commit 8ae292c66dcb ("x86/lib: Address
kernel-doc warnings") and 3a1d3829e193 ("x86/percpu: Avoid sparse
warning with cast to named address space").

I would even go as far as saying that 1ca3683cc6d2 ("x86/percpu:
Enable named address spaces with known compiler version") together
with 3a1d3829e193 ("x86/percpu: Avoid sparse warning with cast to
named address space") triggered this problem