gpio: ftgpio: Fix an error handling path in 'ftgpio_gpio_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 22 Aug 2019 20:45:38 +0000 (22:45 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 23 Aug 2019 10:02:34 +0000 (12:02 +0200)
If 'devm_kcalloc()' fails, we should go through the error handling path,
should some clean-up be needed.

Fixes: 42d9fc7176eb ("gpio: ftgpio: Pass irqchip when adding gpiochip")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20190822204538.4791-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-ftgpio010.c

index 3118d282514a49f68496434637630b3c6977c38d..fbddb166242874d3669ed83ba6cddc2dec225be8 100644 (file)
@@ -290,8 +290,10 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
        girq->num_parents = 1;
        girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
                                     GFP_KERNEL);
-       if (!girq->parents)
-               return -ENOMEM;
+       if (!girq->parents) {
+               ret = -ENOMEM;
+               goto dis_clk;
+       }
        girq->default_type = IRQ_TYPE_NONE;
        girq->handler = handle_bad_irq;
        girq->parents[0] = irq;