target: Convert target_core_rd.c to use use BUG_ON

Use BUG_ON(x) rather than if(x) BUG();

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ identifier x; @@
-if (x) BUG();
+BUG_ON(x);

@@ identifier x; @@
-if (!x) BUG();
+BUG_ON(!x);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
Julia Lawall 2011-08-02 12:35:02 +02:00 committed by Nicholas Bellinger
parent 9be08c5804
commit 6fc6148865

View file

@ -390,12 +390,10 @@ static int rd_MEMCPY_read(struct rd_request *req)
length = req->rd_size;
dst = sg_virt(&sg_d[i++]) + dst_offset;
if (!dst)
BUG();
BUG_ON(!dst);
src = sg_virt(&sg_s[j]) + src_offset;
if (!src)
BUG();
BUG_ON(!src);
dst_offset = 0;
src_offset = length;
@ -415,8 +413,7 @@ static int rd_MEMCPY_read(struct rd_request *req)
length = req->rd_size;
dst = sg_virt(&sg_d[i]) + dst_offset;
if (!dst)
BUG();
BUG_ON(!dst);
if (sg_d[i].length == length) {
i++;
@ -425,8 +422,7 @@ static int rd_MEMCPY_read(struct rd_request *req)
dst_offset = length;
src = sg_virt(&sg_s[j++]) + src_offset;
if (!src)
BUG();
BUG_ON(!src);
src_offset = 0;
page_end = 1;
@ -510,12 +506,10 @@ static int rd_MEMCPY_write(struct rd_request *req)
length = req->rd_size;
src = sg_virt(&sg_s[i++]) + src_offset;
if (!src)
BUG();
BUG_ON(!src);
dst = sg_virt(&sg_d[j]) + dst_offset;
if (!dst)
BUG();
BUG_ON(!dst);
src_offset = 0;
dst_offset = length;
@ -535,8 +529,7 @@ static int rd_MEMCPY_write(struct rd_request *req)
length = req->rd_size;
src = sg_virt(&sg_s[i]) + src_offset;
if (!src)
BUG();
BUG_ON(!src);
if (sg_s[i].length == length) {
i++;
@ -545,8 +538,7 @@ static int rd_MEMCPY_write(struct rd_request *req)
src_offset = length;
dst = sg_virt(&sg_d[j++]) + dst_offset;
if (!dst)
BUG();
BUG_ON(!dst);
dst_offset = 0;
page_end = 1;