Re: [PATCH] Staging: olpc_dcon: Use WARN_ON() instead of BUG_ON()

2019-04-16 Thread Greg KH
On Fri, Apr 05, 2019 at 02:28:36PM -0500, Madhumitha Prabakaran wrote:
> Use WARN_ON() instead of BUG_ON(), as the WARN_ON() produces a backtrace
> without crashing the kernel.
> 
> Issue found by checkpatch.pl.
> 
> Signed-off-by: Madhumitha Prabakaran 
> ---
>  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 6b714f740ac3..900baab70691 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)));

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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: olpc_dcon: Use WARN_ON() instead of BUG_ON()

2019-04-05 Thread 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.

Signed-off-by: Madhumitha Prabakaran 
---
 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 6b714f740ac3..900baab70691 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, , 1, NULL, 0);
msleep(100);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC/PATCH] staging: olpc_dcon: Use WARN_ON instead of BUG_ON

2019-03-24 Thread Greg KH
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 
> ---
>  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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC/PATCH] staging: olpc_dcon: Use WARN_ON instead of BUG_ON

2019-03-24 Thread Bharath Vedartham
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 
---
 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, , 1, NULL, 0);
msleep(100);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel