Skip to content

Commit 77461c1

Browse files
leitaokuba-moo
authored andcommitted
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: 74293ea ("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>
1 parent 3b3a2a9 commit 77461c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/net-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ static const struct attribute_group dql_group = {
15241524
};
15251525
#else
15261526
/* Fake declaration, all the code using it should be dead */
1527-
extern const struct attribute_group dql_group;
1527+
static const struct attribute_group dql_group = {};
15281528
#endif /* CONFIG_BQL */
15291529

15301530
#ifdef CONFIG_XPS

0 commit comments

Comments
 (0)