diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2020-04-08 14:20:47 +0300 |
---|---|---|
committer | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2020-04-08 14:25:32 +0300 |
commit | 6425c0e1f8a5d0d698c9b604de7f55b85ccddf1f (patch) | |
tree | 3752113e524aeaa77397b1f14f41ce6c1c345798 /include | |
parent | d3add33ae8a9f25b031ea00deef932974482c230 (diff) |
bug: fix possible build error
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 <oleksandr.suvorov@toradex.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/bug.h | 6 |
1 files 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 <linux/kernel.h> #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 <linux/kernel.h> + +#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 |