[PATCH] media: omap2: omapfb: fix bugon.cocci warnings

kbuild test robot fengguang.wu at intel.com
Wed Jul 25 17:57:00 UTC 2018


From: kbuild test robot <fengguang.wu at intel.com>

drivers/video/fbdev/omap2/omapfb/dss/dss_features.c:895:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.
Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h)

 Use BUG_ON instead of a if condition followed by BUG.

Semantic patch information:
 This makes an effort to find cases where BUG() follows an if
 condition on an expression and replaces the if condition and BUG()
 with a BUG_ON having the conditional expression of the if statement
 as argument.

Generated by: scripts/coccinelle/misc/bugon.cocci

Fixes: 7378f1149884 ("media: omap2: omapfb: allow building it with COMPILE_TEST")
Signed-off-by: kbuild test robot <fengguang.wu at intel.com>
---

Please take the patch only if it's a positive warning. Thanks!

 dss_features.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/video/fbdev/omap2/omapfb/dss/dss_features.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dss_features.c
@@ -891,8 +891,7 @@ bool dss_has_feature(enum dss_feat_id id
 
 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
 {
-	if (id >= omap_current_dss_features->num_reg_fields)
-		BUG();
+	BUG_ON(id >= omap_current_dss_features->num_reg_fields);
 
 	*start = omap_current_dss_features->reg_fields[id].start;
 	*end = omap_current_dss_features->reg_fields[id].end;


More information about the dri-devel mailing list