Skip to contentSkip to conversation

Staging: olpc_dcon: Use WARN_ON() instead of BUG_ON()

PATCH In review Madhumitha Prabakaran 2 participants 2 messages Apr 5, 2019 – Apr 16, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: olpc_dcon: Use WARN_ON() instead of BUG_ON()

Use WARN_ON() instead of BUG_ON(), as the WARN_ON() produces a backtrace without crashing the kernel.

Issue found by checkpatch.pl.

---
 drivers/staging/olpc_dcon/olpc_dcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/olpc_dcon/olpc_dcon.c +1 -1
index 6b714f740ac3..900baab70691 100644
@@ -138,7 +138,7 @@ static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down)
 	}
 	if (x < 0) {
 		pr_err("unable to stabilize dcon's smbus, reasserting power and praying.\n");
-		BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
+		WARN_ON(olpc_board_at_least(olpc_board(0xc2)));
 		pm = 0;
 		olpc_ec_cmd(EC_DCON_POWER_MODE, &pm, 1, NULL, 0);
 		msleep(100);
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 15 lines · Madhumitha Prabakaran

Use WARN_ON() instead of BUG_ON(), as the WARN_ON() produces a backtrace without crashing the kernel.

Issue found by checkpatch.pl.

---
 drivers/staging/olpc_dcon/olpc_dcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/olpc_dcon/olpc_dcon.c +0 -0
index 6b714f740ac3..900baab70691 100644

drivers/staging/olpc_dcon/olpc_dcon.c static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down) · line 141

Quoted 5 lines
drivers/staging/olpc_dcon/olpc_dcon.c +1 -1
@@ -138,7 +138,7 @@ static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down)
 	}
 	if (x < 0) {
 		pr_err("unable to stabilize dcon's smbus, reasserting power and praying.\n");
-		BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
+		WARN_ON(olpc_board_at_least(olpc_board(0xc2)));

If this change was as simple as this, we would have done it already :(

You have to properly handle this error that used to crash the system, by properly correctly for it and continuing on. You can't just log it and keep on going, right?

thanks,

greg k-h