lkml.org 
[lkml]   [2011]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 9/11] drivers/target/target_core_rd.c: trivial: use BUG_ON
From
Date
On Tue, 2011-08-02 at 12:35 +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> 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>
>

Hi Julia,

Committed as 5acbe8a85d7 into lio-core-2.6.git/master, and will be
queued for the next round of target updates.

Thanks!

--nab

> ---
> drivers/target/target_core_rd.c | 24 ++++++++----------------
> 1 file changed, 8 insertions(+), 16 deletions(-)
>
> diff -u -p a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
> --- a/drivers/target/target_core_rd.c
> +++ b/drivers/target/target_core_rd.c
> @@ -390,12 +390,10 @@ static int rd_MEMCPY_read(struct rd_requ
> 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_requ
> 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_requ
> 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_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_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_req
> src_offset = length;
>
> dst = sg_virt(&sg_d[j++]) + dst_offset;
> - if (!dst)
> - BUG();
> + BUG_ON(!dst);
>
> dst_offset = 0;
> page_end = 1;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html



\
 
 \ /
  Last update: 2011-08-04 20:17    [W:0.094 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site