Skip to contentSkip to conversation

drm/omapdrm: use BUG_ON macro for error debugging.

PATCH Superseded Wambui Karuga 2 participants 2 messages Jan 2, 2020 – Jan 8, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/omapdrm: use BUG_ON macro for error debugging.

Since the if statement only checks for the value of the id variable, it can be replaced by the more concise BUG_ON() macro for error reporting.
Issue found using coccinelle.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +1 -2
index 413dbdd1771e..dbb90f2d2ccd 100644
@@ -393,8 +393,7 @@ static void dispc_get_reg_field(struct dispc_device *dispc,
 				enum dispc_feat_reg_field id,
 				u8 *start, u8 *end)
 {
-	if (id >= dispc->feat->num_reg_fields)
-		BUG();
+	BUG_ON(id >= dispc->feat->num_reg_fields);
 
 	*start = dispc->feat->reg_fields[id].start;
 	*end = dispc->feat->reg_fields[id].end;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Wambui Karuga

Since the if statement only checks for the value of the id variable, it can be replaced by the more concise BUG_ON() macro for error reporting.
Issue found using coccinelle.

Tomi said he's ok with this landing in drm-misc-next on irc, so merged. Thanks for your patch!
-Daniel

Quoted 21 lines
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +1 -2
index 413dbdd1771e..dbb90f2d2ccd 100644
@@ -393,8 +393,7 @@ static void dispc_get_reg_field(struct dispc_device *dispc,
 				enum dispc_feat_reg_field id,
 				u8 *start, u8 *end)
 {
-	if (id >= dispc->feat->num_reg_fields)
-		BUG();
+	BUG_ON(id >= dispc->feat->num_reg_fields);
 
 	*start = dispc->feat->reg_fields[id].start;
 	*end = dispc->feat->reg_fields[id].end;
Signature · 1 line
2.17.1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel