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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
......
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