Skip to content

Commit

Permalink
gpio: ftgpio: Fix an error handling path in 'ftgpio_gpio_probe()'
Browse files Browse the repository at this point in the history
If 'devm_kcalloc()' fails, we should go through the error handling path,
should some clean-up be needed.

Fixes: 42d9fc7 ("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>
  • Loading branch information
Christophe JAILLET authored and Linus Walleij committed Aug 23, 2019
1 parent c7663fa commit b1d64c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/gpio/gpio-ftgpio010.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b1d64c7

Please sign in to comment.