linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH] staging: olpc_dcon: Use WARN_ON instead of BUG_ON
@ 2019-03-24 12:12 Bharath Vedartham
  2019-03-24 12:19 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Bharath Vedartham @ 2019-03-24 12:12 UTC (permalink / raw)
  To: gregkh, jfrederich, dsd, jon.nettleton; +Cc: devel, linux-kernel

This is with respect to a checkpatch.pl CHECK: "Avoid crashing the
kernel. Use WARN_ON instead of BUG_ON". But I maybe wrong here. Is a
kernel crash desired if olpc_board_at_least(olpc_board(0xc2)) fails,
will there be inconsistent results if execution continues?

Signed-off-by: Bharath Vedartham <linux.bhar@gmail.com>
---
 drivers/staging/olpc_dcon/olpc_dcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
index 6b714f7..900baab7 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -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);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC/PATCH] staging: olpc_dcon: Use WARN_ON instead of BUG_ON
  2019-03-24 12:12 [RFC/PATCH] staging: olpc_dcon: Use WARN_ON instead of BUG_ON Bharath Vedartham
@ 2019-03-24 12:19 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-03-24 12:19 UTC (permalink / raw)
  To: Bharath Vedartham; +Cc: jfrederich, dsd, jon.nettleton, devel, linux-kernel

On Sun, Mar 24, 2019 at 05:42:08PM +0530, Bharath Vedartham wrote:
> This is with respect to a checkpatch.pl CHECK: "Avoid crashing the
> kernel. Use WARN_ON instead of BUG_ON". But I maybe wrong here. Is a
> kernel crash desired if olpc_board_at_least(olpc_board(0xc2)) fails,
> will there be inconsistent results if execution continues?
> 
> Signed-off-by: Bharath Vedartham <linux.bhar@gmail.com>
> ---
>  drivers/staging/olpc_dcon/olpc_dcon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
> index 6b714f7..900baab7 100644
> --- a/drivers/staging/olpc_dcon/olpc_dcon.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon.c
> @@ -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)));

Shouldn't you do something to handle this error, if it can actually
happen?  Don't just warn and keep on going, if this was all that was
needed to fix up these types of issues, we could do it all in one simple
search/replace step :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-24 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-24 12:12 [RFC/PATCH] staging: olpc_dcon: Use WARN_ON instead of BUG_ON Bharath Vedartham
2019-03-24 12:19 ` Greg KH

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).