asm-generic: add unlikely to default BUG_ON(x)
authorDenis Efremov <efremov@linux.com>
Wed, 28 Aug 2019 21:09:34 +0000 (00:09 +0300)
committerArnd Bergmann <arnd@arndb.de>
Sun, 1 Sep 2019 21:53:39 +0000 (23:53 +0200)
Add unlikely to default BUG_ON(x) in !CONFIG_BUG. It makes
the define consistent with BUG_ON(x) in CONFIG_BUG.

Signed-off-by: Denis Efremov <efremov@linux.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
include/asm-generic/bug.h

index aa6c093d9ce910890452caeeabcde619171c706f..7357a3c942a06cf18e199ddd9cd8710c27581888 100644 (file)
@@ -185,7 +185,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
 #endif
 
 #ifndef HAVE_ARCH_BUG_ON
-#define BUG_ON(condition) do { if (condition) BUG(); } while (0)
+#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON