| From: |
| Linux Kernel Mailing List <linux-kernel@vger.kernel.org> |
| To: |
| BK Commits List:; |
| Subject: |
| Make a polite version of BUG_ON() - WARN_ON() which doesn't |
| Date: |
| Fri, 18 Oct 2002 23:28:57 +0000 |
ChangeSet 1.803, 2002/10/18 16:28:57-07:00, torvalds@home.transmeta.com
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.
# This patch includes the following deltas:
# ChangeSet 1.802 -> 1.803
# include/linux/kernel.h 1.23 -> 1.24
# drivers/base/core.c 1.46 -> 1.47
#
drivers/base/core.c | 2 +-
include/linux/kernel.h | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c Fri Oct 18 17:07:03 2002
+++ b/drivers/base/core.c Fri Oct 18 17:07:03 2002
@@ -136,7 +136,7 @@
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 -Nru a/include/linux/kernel.h b/include/linux/kernel.h
--- a/include/linux/kernel.h Fri Oct 18 17:07:03 2002
+++ b/include/linux/kernel.h Fri Oct 18 17:07:03 2002
@@ -200,6 +200,12 @@
};
#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)
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html