]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net: dqs: Do not use extern for unused dql_group
authorBreno Leitao <leitao@debian.org>
Mon, 2 Sep 2024 10:17:30 +0000 (03:17 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Sep 2024 19:01:38 +0000 (12:01 -0700)
commit77461c10819103eaee7b33c744174b32a8c78b40
treee4d9525e374fb87193b48442c5d7bd0f550cb778
parent3b3a2a9c6349e25a025d2330f479bc33a6ccb54a
net: dqs: Do not use extern for unused dql_group

When CONFIG_DQL is not enabled, dql_group should be treated as a dead
declaration. However, its current extern declaration assumes the linker
will ignore it, which is generally true across most compiler and
architecture combinations.

But in certain cases, the linker still attempts to resolve the extern
struct, even when the associated code is dead, resulting in a linking
error. For instance the following error in loongarch64:

>> loongarch64-linux-ld: net-sysfs.c:(.text+0x589c): undefined reference to `dql_group'

Modify the declaration of the dead object to be an empty declaration
instead of an extern. This change will prevent the linker from
attempting to resolve an undefined reference.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409012047.eCaOdfQJ-lkp@intel.com/
Fixes: 74293ea1c4db ("net: sysfs: Do not create sysfs for non BQL device")
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Simon Horman <horms@kernel.org> # build-tested
Link: https://patch.msgid.link/20240902101734.3260455-1-leitao@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/net-sysfs.c