diff mbox series

[v1,09/13] gpio: dwapb: Drop bogus BUG_ON()s

Message ID 20200409141228.49561-10-andriy.shevchenko@linux.intel.com
State New
Headers show
Series gpio: dwapb: Clean up the driver and a fix | expand

Commit Message

Andy Shevchenko April 9, 2020, 2:12 p.m. UTC
There is no case when no context is provided in the ->suspend() and
->resume() hooks. Moreover, BUG_ON() is harmful to user and makes kernel
inoperable after the crash. Drop the BUG_ON()s for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-dwapb.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Serge Semin April 15, 2020, 1:05 p.m. UTC | #1
On Thu, Apr 09, 2020 at 05:12:24PM +0300, Andy Shevchenko wrote:
> There is no case when no context is provided in the ->suspend() and
> ->resume() hooks. Moreover, BUG_ON() is harmful to user and makes kernel
> inoperable after the crash. Drop the BUG_ON()s for good.

Right. Thanks. Though I wouldn't name them bogus, but redundant or
unnecessary instead.

Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-dwapb.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index a15652ff9495..c03d856be703 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -723,8 +723,6 @@ static int dwapb_gpio_suspend(struct device *dev)
>  		unsigned int idx = gpio->ports[i].idx;
>  		struct dwapb_context *ctx = gpio->ports[i].ctx;
>  
> -		BUG_ON(!ctx);
> -
>  		offset = GPIO_SWPORTA_DDR + idx * GPIO_SWPORT_DDR_STRIDE;
>  		ctx->dir = dwapb_read(gpio, offset);
>  
> @@ -773,8 +771,6 @@ static int dwapb_gpio_resume(struct device *dev)
>  		unsigned int idx = gpio->ports[i].idx;
>  		struct dwapb_context *ctx = gpio->ports[i].ctx;
>  
> -		BUG_ON(!ctx);
> -
>  		offset = GPIO_SWPORTA_DR + idx * GPIO_SWPORT_DR_STRIDE;
>  		dwapb_write(gpio, offset, ctx->data);
>  
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index a15652ff9495..c03d856be703 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -723,8 +723,6 @@  static int dwapb_gpio_suspend(struct device *dev)
 		unsigned int idx = gpio->ports[i].idx;
 		struct dwapb_context *ctx = gpio->ports[i].ctx;
 
-		BUG_ON(!ctx);
-
 		offset = GPIO_SWPORTA_DDR + idx * GPIO_SWPORT_DDR_STRIDE;
 		ctx->dir = dwapb_read(gpio, offset);
 
@@ -773,8 +771,6 @@  static int dwapb_gpio_resume(struct device *dev)
 		unsigned int idx = gpio->ports[i].idx;
 		struct dwapb_context *ctx = gpio->ports[i].ctx;
 
-		BUG_ON(!ctx);
-
 		offset = GPIO_SWPORTA_DR + idx * GPIO_SWPORT_DR_STRIDE;
 		dwapb_write(gpio, offset, ctx->data);