Skip to content

Commit

Permalink
x86: always define BUG() and HAVE_ARCH_BUG, even with !CONFIG_BUG
Browse files Browse the repository at this point in the history
This ensures that BUG() always has a definition that causes a trap (via
an undefined instruction), and that the compiler still recognizes the
code following BUG() as unreachable, avoiding warnings that would
otherwise appear (such as on non-void functions that don't return a
value after BUG()).

In addition to saving a few bytes over the generic infinite-loop
implementation, this implementation traps rather than looping, which
potentially allows for better error-recovery behavior (such as by
rebooting).

Signed-off-by: Josh Triplett <[email protected]>
Reported-by: Arnd Bergmann <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
joshtriplett authored and torvalds committed Apr 7, 2014
1 parent a4b5d58 commit b06dd87
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions arch/x86/include/asm/bug.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef _ASM_X86_BUG_H
#define _ASM_X86_BUG_H

#ifdef CONFIG_BUG
#define HAVE_ARCH_BUG

#ifdef CONFIG_DEBUG_BUGVERBOSE
Expand Down Expand Up @@ -33,8 +32,6 @@ do { \
} while (0)
#endif

#endif /* !CONFIG_BUG */

#include <asm-generic/bug.h>

#endif /* _ASM_X86_BUG_H */

0 comments on commit b06dd87

Please sign in to comment.