* [PATCH] gpio: omap: Fix error path on chip init
@ 2018-01-02 10:23 Linus Walleij
2018-01-02 10:39 ` Johan Hovold
2018-01-12 21:13 ` Grygorii Strashko
0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2018-01-02 10:23 UTC (permalink / raw)
To: linux-gpio; +Cc: Linus Walleij, Johan Hovold
The error path was leaking a gpio_chip at one point.
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-omap.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index e136d666f1e5..d83e8624964a 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1104,7 +1104,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
-1, 0, bank->width, 0);
if (irq_base < 0) {
dev_err(bank->chip.parent, "Couldn't allocate IRQ numbers\n");
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_remove_chip;
}
#endif
@@ -1122,8 +1123,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
if (ret) {
dev_err(bank->chip.parent,
"Couldn't add irqchip to gpiochip %d\n", ret);
- gpiochip_remove(&bank->chip);
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_remove_chip;
}
gpiochip_set_chained_irqchip(&bank->chip, irqc, bank->irq, NULL);
@@ -1132,8 +1133,12 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
omap_gpio_irq_handler,
0, dev_name(bank->chip.parent), bank);
if (ret)
- gpiochip_remove(&bank->chip);
+ goto err_remove_chip;
+ return 0;
+
+err_remove_chip:
+ gpiochip_remove(&bank->chip);
return ret;
}
--
2.14.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: omap: Fix error path on chip init
2018-01-02 10:23 [PATCH] gpio: omap: Fix error path on chip init Linus Walleij
@ 2018-01-02 10:39 ` Johan Hovold
2018-01-12 21:13 ` Grygorii Strashko
1 sibling, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2018-01-02 10:39 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, Johan Hovold
On Tue, Jan 02, 2018 at 11:23:14AM +0100, Linus Walleij wrote:
> The error path was leaking a gpio_chip at one point.
>
> Cc: Johan Hovold <johan@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: omap: Fix error path on chip init
2018-01-02 10:23 [PATCH] gpio: omap: Fix error path on chip init Linus Walleij
2018-01-02 10:39 ` Johan Hovold
@ 2018-01-12 21:13 ` Grygorii Strashko
2018-01-18 3:07 ` Johan Hovold
1 sibling, 1 reply; 4+ messages in thread
From: Grygorii Strashko @ 2018-01-12 21:13 UTC (permalink / raw)
To: Linus Walleij, linux-gpio; +Cc: Johan Hovold
On 01/02/2018 04:23 AM, Linus Walleij wrote:
> The error path was leaking a gpio_chip at one point.
>
> Cc: Johan Hovold <johan@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Sry, but this seems not in sync with gpio-next [1]
https://patchwork.kernel.org/patch/10060049/
> ---
> drivers/gpio/gpio-omap.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index e136d666f1e5..d83e8624964a 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1104,7 +1104,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
> -1, 0, bank->width, 0);
> if (irq_base < 0) {
> dev_err(bank->chip.parent, "Couldn't allocate IRQ numbers\n");
> - return -ENODEV;
> + ret = -ENODEV;
> + goto err_remove_chip;
> }
> #endif
>
> @@ -1122,8 +1123,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
> if (ret) {
> dev_err(bank->chip.parent,
> "Couldn't add irqchip to gpiochip %d\n", ret);
> - gpiochip_remove(&bank->chip);
> - return -ENODEV;
> + ret = -ENODEV;
> + goto err_remove_chip;
> }
>
> gpiochip_set_chained_irqchip(&bank->chip, irqc, bank->irq, NULL);
> @@ -1132,8 +1133,12 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
> omap_gpio_irq_handler,
> 0, dev_name(bank->chip.parent), bank);
> if (ret)
> - gpiochip_remove(&bank->chip);
> + goto err_remove_chip;
>
> + return 0;
> +
> +err_remove_chip:
> + gpiochip_remove(&bank->chip);
> return ret;
> }
>
>
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: omap: Fix error path on chip init
2018-01-12 21:13 ` Grygorii Strashko
@ 2018-01-18 3:07 ` Johan Hovold
0 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2018-01-18 3:07 UTC (permalink / raw)
To: Grygorii Strashko; +Cc: Linus Walleij, linux-gpio, Johan Hovold
On Fri, Jan 12, 2018 at 03:13:44PM -0600, Grygorii Strashko wrote:
>
>
> On 01/02/2018 04:23 AM, Linus Walleij wrote:
> > The error path was leaking a gpio_chip at one point.
> >
> > Cc: Johan Hovold <johan@kernel.org>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
>
> Sry, but this seems not in sync with gpio-next [1]
>
> https://patchwork.kernel.org/patch/10060049/
Indeed. That patch inadvertently fixed the broken error path.
Thanks,
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-18 3:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-02 10:23 [PATCH] gpio: omap: Fix error path on chip init Linus Walleij
2018-01-02 10:39 ` Johan Hovold
2018-01-12 21:13 ` Grygorii Strashko
2018-01-18 3:07 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).