Skip to content

Commit

Permalink
pinctrl: bcm2835: Remove gpiochip on error
Browse files Browse the repository at this point in the history
A failure in gpiochip_irqchip_add leads to a leak of a gpiochip. Fix
the leak with the use of devm_gpiochip_add_data.

Fixes: 85ae9e5 ("pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP")
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  • Loading branch information
Phil Elwell committed Jan 7, 2020
1 parent 1d1eead commit e99b5a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pinctrl/bcm/pinctrl-bcm2835.c
Expand Up @@ -1140,7 +1140,7 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
raw_spin_lock_init(&pc->irq_lock[i]);
}

err = gpiochip_add_data(&pc->gpio_chip, pc);
err = devm_gpiochip_add_data(dev, &pc->gpio_chip, pc);
if (err) {
dev_err(dev, "could not add GPIO chip\n");
return err;
Expand Down

0 comments on commit e99b5a3

Please sign in to comment.