diff mbox series

[2/2] gpio: twl4030: Don't return an error after WARN in .remove

Message ID 20220614152339.252958-2-u.kleine-koenig@pengutronix.de
State New
Headers show
Series [1/2] gpio: twl4030: Drop platform teardown callback | expand

Commit Message

Uwe Kleine-König June 14, 2022, 3:23 p.m. UTC
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>
---
 drivers/gpio/gpio-twl4030.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Bartosz Golaszewski June 23, 2022, 9:11 p.m. UTC | #1
On Tue, Jun 14, 2022 at 5:23 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> 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>
> ---

Applied, thanks!

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index e2cb7cb90c8c..5046e51af8df 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -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[] = {