@@ -6,17 +6,24 @@
#include <linux/compiler.h>
#include <linux/printk.h>
+#ifdef CONFIG_BUG_CHECKS
#define BUG() do { \
printk("BUG at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
panic("BUG!"); \
} while (0)
+#define __WARN() \
+ printk("WARNING at %s:%d/%s()!\n", __FILE__, __LINE__, __func__)
+#else
+#define BUG() do {} while (0)
+#define __WARN() do {} while (0)
+#endif
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
#define WARN_ON(condition) ({ \
int __ret_warn_on = !!(condition); \
if (unlikely(__ret_warn_on)) \
- printk("WARNING at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
+ __WARN(); \
unlikely(__ret_warn_on); \
})
@@ -45,6 +45,15 @@ config USE_TINY_PRINTF
The supported format specifiers are %c, %s, %u/%d and %x.
+config BUG_CHECKS
+ bool "Enable BUG/BUG_ON() checks and WARN_ON() logs"
+ default y
+ help
+ BUG(), BUG_ON(), and WARN_ON() print noisy messages. BUG() and
+ BUG_ON() also reboot or halt the system.
+
+ Disable this if your platform needs to save memory footprint.
+
config PANIC_HANG
bool "Do not reset the system on fatal error"
help