bcm27xx: add kernel 5.10 support
[openwrt/staging/noltari.git] / target / linux / bcm27xx / patches-5.10 / 950-0185-pinctrl-bcm2835-Remove-gpiochip-on-error.patch
1 From 0da3ef334d4949431f34fea9f315d967e47a6a73 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Mon, 6 Jan 2020 16:04:30 +0000
4 Subject: [PATCH] pinctrl: bcm2835: Remove gpiochip on error
5
6 A failure in gpiochip_irqchip_add leads to a leak of a gpiochip. Fix
7 the leak with the use of devm_gpiochip_add_data.
8
9 Fixes: 85ae9e512f43 ("pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP")
10 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
11 ---
12 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
16 +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
17 @@ -1300,7 +1300,7 @@ static int bcm2835_pinctrl_probe(struct
18 girq->default_type = IRQ_TYPE_NONE;
19 girq->handler = handle_level_irq;
20
21 - err = gpiochip_add_data(&pc->gpio_chip, pc);
22 + err = devm_gpiochip_add_data(dev, &pc->gpio_chip, pc);
23 if (err) {
24 dev_err(dev, "could not add GPIO chip\n");
25 return err;