diff mbox series

[v2,03/20] gpio: mc33880: Drop if with an always false condition

Message ID 20211012153945.2651412-4-u.kleine-koenig@pengutronix.de
State New
Headers show
Series Make some spi device drivers return zero in .remove() | expand

Commit Message

Uwe Kleine-König Oct. 12, 2021, 3:39 p.m. UTC
An spi remove callback is only called for devices that probed
successfully. In this case this implies that mc33880_probe() set a
non-NULL driver data. So the check for mc being NULL is never true and
the check can be dropped.

Also the return value ofspi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpio-mc33880.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Bartosz Golaszewski Oct. 13, 2021, 5:53 p.m. UTC | #1
On Tue, Oct 12, 2021 at 5:39 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> An spi remove callback is only called for devices that probed
> successfully. In this case this implies that mc33880_probe() set a
> non-NULL driver data. So the check for mc being NULL is never true and
> the check can be dropped.
>
> Also the return value ofspi remove callbacks is ignored anyway.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/gpio/gpio-mc33880.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
> index f8194f7c6186..31d2be1bebc8 100644
> --- a/drivers/gpio/gpio-mc33880.c
> +++ b/drivers/gpio/gpio-mc33880.c
> @@ -139,8 +139,6 @@ static int mc33880_remove(struct spi_device *spi)
>         struct mc33880 *mc;
>
>         mc = spi_get_drvdata(spi);
> -       if (!mc)
> -               return -ENODEV;
>
>         gpiochip_remove(&mc->chip);
>         mutex_destroy(&mc->lock);
> --
> 2.30.2
>

Applied, thanks!

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
index f8194f7c6186..31d2be1bebc8 100644
--- a/drivers/gpio/gpio-mc33880.c
+++ b/drivers/gpio/gpio-mc33880.c
@@ -139,8 +139,6 @@  static int mc33880_remove(struct spi_device *spi)
 	struct mc33880 *mc;
 
 	mc = spi_get_drvdata(spi);
-	if (!mc)
-		return -ENODEV;
 
 	gpiochip_remove(&mc->chip);
 	mutex_destroy(&mc->lock);