* [PATCH] staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG
@ 2019-05-18 17:33 Hariprasad Kelam
2019-05-19 8:24 ` Gao Xiang
2019-05-19 9:35 ` [PATCH v2] " Gao Xiang
0 siblings, 2 replies; 4+ messages in thread
From: Hariprasad Kelam @ 2019-05-18 17:33 UTC (permalink / raw)
fix below warning reported by coccicheck
drivers/staging/erofs/unzip_pagevec.h:74:2-5: WARNING: Use BUG_ON
instead of if condition followed by BUG.
Signed-off-by: Hariprasad Kelam <hariprasad.kelam at gmail.com>
---
drivers/staging/erofs/unzip_pagevec.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/erofs/unzip_pagevec.h b/drivers/staging/erofs/unzip_pagevec.h
index f37d8fd..0f61c54 100644
--- a/drivers/staging/erofs/unzip_pagevec.h
+++ b/drivers/staging/erofs/unzip_pagevec.h
@@ -70,8 +70,7 @@ z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor,
return tagptr_unfold_ptr(t);
}
- if (unlikely(nr >= ctor->nr))
- BUG();
+ BUG_ON(nr >= ctor->nr);
return NULL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG
2019-05-18 17:33 [PATCH] staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG Hariprasad Kelam
@ 2019-05-19 8:24 ` Gao Xiang
2019-05-19 9:35 ` [PATCH v2] " Gao Xiang
1 sibling, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2019-05-19 8:24 UTC (permalink / raw)
Hi Hariprasad,
On 2019/5/19 ??1:33, Hariprasad Kelam wrote:
> fix below warning reported by coccicheck
>
> drivers/staging/erofs/unzip_pagevec.h:74:2-5: WARNING: Use BUG_ON
> instead of if condition followed by BUG.
>
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam at gmail.com>
> ---
> drivers/staging/erofs/unzip_pagevec.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/erofs/unzip_pagevec.h b/drivers/staging/erofs/unzip_pagevec.h
> index f37d8fd..0f61c54 100644
> --- a/drivers/staging/erofs/unzip_pagevec.h
> +++ b/drivers/staging/erofs/unzip_pagevec.h
> @@ -70,8 +70,7 @@ z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor,
> return tagptr_unfold_ptr(t);
> }
>
> - if (unlikely(nr >= ctor->nr))
> - BUG();
> + BUG_ON(nr >= ctor->nr);
Thanks for your report. I suggest to use DBG_BUGON for this case, let me
send another version for this case.
Thanks,
Gao Xiang
>
> return NULL;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG
2019-05-18 17:33 [PATCH] staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG Hariprasad Kelam
2019-05-19 8:24 ` Gao Xiang
@ 2019-05-19 9:35 ` Gao Xiang
2019-05-20 2:19 ` Chao Yu
1 sibling, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2019-05-19 9:35 UTC (permalink / raw)
From: Hariprasad Kelam <hariprasad.kelam@gmail.com>
fix below warning reported by coccicheck
drivers/staging/erofs/unzip_pagevec.h:74:2-5: WARNING: Use BUG_ON
instead of if condition followed by BUG.
Signed-off-by: Hariprasad Kelam <hariprasad.kelam at gmail.com>
[ Gao Xiang: use DBG_BUGON instead of BUG_ON for eng version only. ]
Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---
change log v2:
- use DBG_BUGON as what said in the commit message.
Thanks,
Gao Xiang
drivers/staging/erofs/unzip_pagevec.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/erofs/unzip_pagevec.h b/drivers/staging/erofs/unzip_pagevec.h
index f37d8fd14771..7af0ba8d8495 100644
--- a/drivers/staging/erofs/unzip_pagevec.h
+++ b/drivers/staging/erofs/unzip_pagevec.h
@@ -69,10 +69,7 @@ z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor,
if (tags == Z_EROFS_PAGE_TYPE_EXCLUSIVE)
return tagptr_unfold_ptr(t);
}
-
- if (unlikely(nr >= ctor->nr))
- BUG();
-
+ DBG_BUGON(nr >= ctor->nr);
return NULL;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG
2019-05-19 9:35 ` [PATCH v2] " Gao Xiang
@ 2019-05-20 2:19 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2019-05-20 2:19 UTC (permalink / raw)
On 2019/5/19 17:35, Gao Xiang wrote:
> From: Hariprasad Kelam <hariprasad.kelam at gmail.com>
>
> fix below warning reported by coccicheck
>
> drivers/staging/erofs/unzip_pagevec.h:74:2-5: WARNING: Use BUG_ON
> instead of if condition followed by BUG.
>
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam at gmail.com>
> [ Gao Xiang: use DBG_BUGON instead of BUG_ON for eng version only. ]
> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
Reviewed-by: Chao Yu <yuchao0 at huawei.com>
Thanks,
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-20 2:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-18 17:33 [PATCH] staging: erofs: fix Warning Use BUG_ON instead of if condition followed by BUG Hariprasad Kelam
2019-05-19 8:24 ` Gao Xiang
2019-05-19 9:35 ` [PATCH v2] " Gao Xiang
2019-05-20 2:19 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).