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