summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2002-10-18 02:28:57 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-10-18 02:28:57 -0700
commit0fffce8f72fa6c9706f65aa4fb564ccbf78a2ecc (patch)
tree25e6fb24a2f270ad057634aa7be29560c15a9ab3
parentfcaf0e9cdbca53a61d131e6c50e437a11ab201c9 (diff)
Make a polite version of BUG_ON() - WARN_ON() which doesn't
kill the machine. Damn I hate people who kill the machine for no good reason.
-rw-r--r--drivers/base/core.c2
-rw-r--r--include/linux/kernel.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index bd82a792d877..a3ff2d8d3444 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -136,7 +136,7 @@ void put_device(struct device * dev)
list_del_init(&dev->g_list);
up(&device_sem);
- BUG_ON((dev->state != DEVICE_GONE));
+ WARN_ON(dev->state != DEVICE_GONE);
device_del(dev);
}
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2def6ba70584..afa757a3b0a1 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -200,6 +200,12 @@ struct sysinfo {
};
#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+#define WARN_ON(condition) do { \
+ if (unlikely((condition)!=0)) { \
+ printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
+ dump_stack(); \
+ } \
+} while (0)
extern void BUILD_BUG(void);
#define BUILD_BUG_ON(condition) do { if (condition) BUILD_BUG(); } while(0)