[PATCH 22/23] rbd: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@xxxxxxxxxxx>
---
 drivers/block/rbd.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index d9c0e7d..798b9ad 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -617,14 +617,7 @@ void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...)
 }
 
 #ifdef RBD_DEBUG
-#define rbd_assert(expr)						\
-		if (unlikely(!(expr))) {				\
-			printk(KERN_ERR "\nAssertion failure in %s() "	\
-						"at line %d:\n\n"	\
-					"\trbd_assert(%s);\n\n",	\
-					__func__, __LINE__, #expr);	\
-			BUG();						\
-		}
+#define rbd_assert(expr)	ASSERT_FAIL(expr)
 #else /* !RBD_DEBUG */
 #  define rbd_assert(expr)	((void) 0)
 #endif /* !RBD_DEBUG */
-- 
1.8.3.1




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux