From 6425c0e1f8a5d0d698c9b604de7f55b85ccddf1f Mon Sep 17 00:00:00 2001 From: Oleksandr Suvorov Date: Wed, 8 Apr 2020 14:20:47 +0300 Subject: bug: fix possible build error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some cases struct bug_entry can be used before declaring [1]. This patch fixes such situations. [1] Building the backports-5.4 for toradex_tk1_l4t_r21.7-next --------------------------- In file included from /home/cryo/work/bp-5.4-clean/backport-include/linux/bug.h:3, from /home/cryo/work/bp-5.4-clean/backport-include/linux/kernel.h:4, from include/asm-generic/bug.h:13, from /home/cryo/work/bp-5.4-clean/backport-include/asm-generic/bug.h:4, from /home/cryo/work/gitlab/linux-toradex-32/arch/arm/include/asm/bug.h:59, from /home/cryo/work/bp-5.4-clean/backport-include/asm/bug.h:4, from /home/cryo/work/gitlab/linux-toradex-32/arch/arm/include/asm/div64.h:63, from include/linux/math64.h:5, from /home/cryo/work/bp-5.4-clean/backport-include/linux/math64.h:3, from include/linux/jiffies.h:4, from /home/cryo/work/bp-5.4-clean/backport-include/linux/jiffies.h:3, from /home/cryo/work/bp-5.4-clean/net/mac80211/rx.c:12: include/linux/bug.h:91:47: warning: ‘struct bug_entry’ declared inside parameter list will not be visible outside of this definition or declaration 91 | static inline int is_warning_bug(const struct bug_entry *bug) | ^~~~~~~~~ include/linux/bug.h: In function ‘is_warning_bug’: include/linux/bug.h:93:12: error: dereferencing pointer to incomplete type ‘const struct bug_entry’ 93 | return bug->flags & BUGFLAG_WARNING; | ^~ --------------------------- Related-to: ELB-2388 Signed-off-by: Oleksandr Suvorov --- include/asm-generic/bug.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 7d10f962aa13..d209bebf85d2 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -10,10 +10,8 @@ #endif #ifndef __ASSEMBLY__ -#include #ifdef CONFIG_BUG - #ifdef CONFIG_GENERIC_BUG struct bug_entry { #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS @@ -32,7 +30,11 @@ struct bug_entry { unsigned short flags; }; #endif /* CONFIG_GENERIC_BUG */ +#endif /* CONFIG_BUG */ +#include + +#ifdef CONFIG_BUG /* * Don't use BUG() or BUG_ON() unless there's really no way out; one * example might be detecting data structure corruption in the middle -- cgit v1.2.3