Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c0a8899 authored by Linus Walleij's avatar Linus Walleij
Browse files

gpio: siox: Do not call gpiochip_remove() on errorpath



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.

Fixes: be8c8fac ("gpio: new driver to work with a 8x12 siox")
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 04ce935c
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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;
}