gpio: twl4030: Don't return an error after WARN in .remove
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 14 Jun 2022 15:23:39 +0000 (17:23 +0200)
committerBartosz Golaszewski <brgl@bgdev.pl>
Tue, 19 Jul 2022 07:56:51 +0000 (09:56 +0200)
Returning a non-zero value in a platform driver's remove callback only
results in an error message ("remove callback returned a non-zero value.
This will be ignored.", see platform_remove()), and then the device is
removed anyhow.

As there was just a WARN_ON triggered, return 0 to drop the follow up
warning. The latter output is hardly relevant after the big WARN splat.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
drivers/gpio/gpio-twl4030.c

index e2cb7cb90c8ca6869a5fa3389e4c0c303de4b9ee..5046e51af8df27c77e4b6c71b55ec6e07fdf4391 100644 (file)
@@ -597,12 +597,9 @@ static int gpio_twl4030_remove(struct platform_device *pdev)
 
        gpiochip_remove(&priv->gpio_chip);
 
-       if (is_module())
-               return 0;
-
        /* REVISIT no support yet for deregistering all the IRQs */
-       WARN_ON(1);
-       return -EIO;
+       WARN_ON(!is_module());
+       return 0;
 }
 
 static const struct of_device_id twl_gpio_match[] = {