Commit 6fc61488 authored by Julia Lawall's avatar Julia Lawall Committed by Nicholas Bellinger

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: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 9be08c58
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment