]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
unreachable: Unify
authorPeter Zijlstra <peterz@infradead.org>
Thu, 28 Nov 2024 09:39:01 +0000 (10:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2025 17:25:35 +0000 (18:25 +0100)
[ Upstream commit c837de3810982cd41cd70e5170da1931439f025c ]

Since barrier_before_unreachable() is empty for !GCC it is trivial to
unify the two definitions. Less is more.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/20241128094311.924381359@infradead.org
Stable-dep-of: 73cfc53cc3b6 ("objtool: Fix C jump table annotations for Clang")
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/compiler-gcc.h
include/linux/compiler.h

index cd6f9aae311fca0f6d13a6534bdcbf24564d3fa3..070b3b680209cda818d1439c053b20f4d41761dc 100644 (file)
  */
 #define barrier_before_unreachable() asm volatile("")
 
-/*
- * Mark a position in code as unreachable.  This can be used to
- * suppress control flow warnings after asm blocks that transfer
- * control elsewhere.
- */
-#define unreachable() \
-       do {                                    \
-               annotate_unreachable();         \
-               barrier_before_unreachable();   \
-               __builtin_unreachable();        \
-       } while (0)
-
 #if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP)
 #define __HAVE_BUILTIN_BSWAP32__
 #define __HAVE_BUILTIN_BSWAP64__
index 2d962dade9faee82154f5886831ec40f036b89f8..0d10d75218f511710d8d470d99b144d5d48d5d38 100644 (file)
@@ -141,12 +141,16 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 #define __annotate_jump_table
 #endif /* CONFIG_OBJTOOL */
 
-#ifndef unreachable
-# define unreachable() do {            \
+/*
+ * Mark a position in code as unreachable.  This can be used to
+ * suppress control flow warnings after asm blocks that transfer
+ * control elsewhere.
+ */
+#define unreachable() do {             \
        annotate_unreachable();         \
+       barrier_before_unreachable();   \
        __builtin_unreachable();        \
 } while (0)
-#endif
 
 /*
  * KENTRY - kernel entry point