diff mbox series

[1/5] gpio: siox: Do not call gpiochip_remove() on errorpath

Message ID 20190626084407.27976-1-linus.walleij@linaro.org
State New
Headers show
Series [1/5] gpio: siox: Do not call gpiochip_remove() on errorpath | expand

Commit Message

Linus Walleij June 26, 2019, 8:44 a.m. UTC
gpiochip_remove() was called on the errorpath if
gpiochip_add() failed: this is wrong, if the chip failed
to add it is not there so it should not be removed.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-siox.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Uwe Kleine-König June 26, 2019, 9:12 a.m. UTC | #1
On Wed, Jun 26, 2019 at 10:44:03AM +0200, Linus Walleij wrote:
> gpiochip_remove() was called on the errorpath if
> gpiochip_add() failed: this is wrong, if the chip failed
> to add it is not there so it should not be removed.
> 
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Does this warrant a

	Fixes: be8c8facc707 ("gpio: new driver to work with a 8x12 siox")

?

Thanks
Uwe
Linus Walleij June 26, 2019, 11:49 a.m. UTC | #2
On Wed, Jun 26, 2019 at 11:12 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> On Wed, Jun 26, 2019 at 10:44:03AM +0200, Linus Walleij wrote:
> > gpiochip_remove() was called on the errorpath if
> > gpiochip_add() failed: this is wrong, if the chip failed
> > to add it is not there so it should not be removed.
> >
> > Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>
> Does this warrant a
>
>         Fixes: be8c8facc707 ("gpio: new driver to work with a 8x12 siox")

Thanks yeah I put the fixes in as a lowprio fix that goes
in with the rest of the v5.3 patches.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-siox.c b/drivers/gpio/gpio-siox.c
index fb4e318ab028..0b4450118865 100644
--- a/drivers/gpio/gpio-siox.c
+++ b/drivers/gpio/gpio-siox.c
@@ -243,17 +243,14 @@  static int gpio_siox_probe(struct siox_device *sdevice)
 	if (ret) {
 		dev_err(&sdevice->dev,
 			"Failed to register gpio chip (%d)\n", ret);
-		goto err_gpiochip;
+		return ret;
 	}
 
 	ret = gpiochip_irqchip_add(&ddata->gchip, &ddata->ichip,
 				   0, handle_level_irq, IRQ_TYPE_EDGE_RISING);
-	if (ret) {
+	if (ret)
 		dev_err(&sdevice->dev,
 			"Failed to register irq chip (%d)\n", ret);
-err_gpiochip:
-		gpiochip_remove(&ddata->gchip);
-	}
 
 	return ret;
 }