[PATCH 08/11] ARM: BUG: Move BUG() into the do-while loop
Sebastian Andrzej Siewior
sebastian at breakpoint.cc
Fri Oct 9 15:21:15 PDT 2026
Make the BUG() macro use the do-while loop and make the __BUG_FLAGS()
use the extra indirection. This shift makes it possible to use
__BUG_FLAGS() macro without having the unreachable() macro.
Signed-off-by: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
---
arch/arm/include/asm/bug.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index b9e58be656360..963365b3158b9 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -19,9 +19,8 @@
#define BUG_ENCODING() .long ___asm_opcode_to_mem_arm(BUG_INSTR_VALUE)
#endif
-
-#define BUG() _BUG(__FILE__, __LINE__)
-#define _BUG(file, line) __BUG(file, line)
+#define __BUG_FLAGS(__file, __line, __flags) __BUG_FLAGS_(__file, __line, __flags)
+#define __BUG_FLAGS_(__file, __line, __flags) __BUG__LINE(__file, __line, __flags)
#ifdef CONFIG_DEBUG_BUGVERBOSE
#define _BUG_VERBOSE_LINE(__file, __line) \
@@ -60,9 +59,9 @@
* preferable to this unpleasantness. We use mergeable string sections to
* avoid multiple copies of the string appearing in the kernel image.
*/
-#define __BUG(__file, __line) \
+#define BUG() \
do { \
- asm volatile(__stringify(__BUG__LINE(__file, __line, 0))); \
+ asm volatile(__stringify(__BUG_FLAGS(__FILE__, __LINE__, 0))); \
unreachable(); \
} while (0)
--
2.55.0
More information about the linux-arm-kernel
mailing list