1 Ensure that when there is an error during probe that the gpiochip is
2 removed and the generic irq chip is removed.
4 Signed-off-by: Andrew Lunn <andrew@lunn.ch>
6 drivers/gpio/gpio-mvebu.c | 23 +++++++++++++++++------
7 1 file changed, 17 insertions(+), 6 deletions(-)
9 --- a/drivers/gpio/gpio-mvebu.c
10 +++ b/drivers/gpio/gpio-mvebu.c
11 @@ -667,6 +667,7 @@ static int mvebu_gpio_probe(struct platf
17 match = of_match_device(mvebu_gpio_of_match, &pdev->dev);
19 @@ -785,14 +786,16 @@ static int mvebu_gpio_probe(struct platf
20 mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1);
21 if (mvchip->irqbase < 0) {
22 dev_err(&pdev->dev, "no irqs\n");
23 - return mvchip->irqbase;
24 + err = mvchip->irqbase;
25 + goto err_gpiochip_add;
28 gc = irq_alloc_generic_chip("mvebu_gpio_irq", 2, mvchip->irqbase,
29 mvchip->membase, handle_level_irq);
31 dev_err(&pdev->dev, "Cannot allocate generic irq_chip\n");
34 + goto err_gpiochip_add;
38 @@ -823,13 +826,21 @@ static int mvebu_gpio_probe(struct platf
39 if (!mvchip->domain) {
40 dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
42 - irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST,
43 - IRQ_LEVEL | IRQ_NOPROBE);
47 + goto err_generic_chip;
53 + irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST,
54 + IRQ_LEVEL | IRQ_NOPROBE);
58 + gpiochip_remove(&mvchip->chip);
63 static struct platform_driver mvebu_gpio_driver = {