From: Bixuan Cui Date: Wed, 2 Jun 2021 03:53:29 +0000 (+1000) Subject: module: fix build error when CONFIG_SYSFS is disabled X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3b0c6724067f875f534c59f0bee5432dc865bb4f;p=users%2Fjedix%2Flinux-maple.git module: fix build error when CONFIG_SYSFS is disabled Fix build error when disable CONFIG_SYSFS: kernel/module.c:2805:8: error: implicit declaration of function `sect_empty'; did you mean `desc_empty'? [-Werror=implicit-function-declaration] 2805 | if (!sect_empty(sechdr) && sechdr->sh_type == SHT_NOTE && Link: https://lkml.kernel.org/r/20210525105049.34804-1-cuibixuan@huawei.com Fixes: 9ee6682aa528 ("module: add printk formats to add module build ID to stacktraces") Reported-by: Hulk Robot Signed-off-by: Bixuan Cui Signed-off-by: Stephen Boyd Acked-by: Jessica Yu Signed-off-by: Andrew Morton Signed-off-by: Stephen Rothwell --- diff --git a/kernel/module.c b/kernel/module.c index e9bca1624362..25dbdaf1f337 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1462,6 +1462,13 @@ resolve_symbol_wait(struct module *mod, return ksym; } +#ifdef CONFIG_KALLSYMS +static inline bool sect_empty(const Elf_Shdr *sect) +{ + return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; +} +#endif + /* * /sys/module/foo/sections stuff * J. Corbet @@ -1469,11 +1476,6 @@ resolve_symbol_wait(struct module *mod, #ifdef CONFIG_SYSFS #ifdef CONFIG_KALLSYMS -static inline bool sect_empty(const Elf_Shdr *sect) -{ - return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; -} - struct module_sect_attr { struct bin_attribute battr; unsigned long address;