[PATCH] pinctrl: bcm2835: Don't remove an unregistered GPIO chip
Linus Walleij
linusw at kernel.org
Tue Jun 30 05:10:51 PDT 2026
On Wed, Jun 17, 2026 at 11:05 PM Daniel McCarthy <daniel at dragonzap.com> wrote:
> If the devm_pinctrl_register() function fails,
> bcm2835_pinctrl_probe() calls gpiochip_remove()
> before gpiochip_add_data() has registered the GPIO chip.
>
> This means that upon failure the gpio_chip.gpiodev
> is NULL resulting in a null pointer dereference
> inside the gpiochip_remove() function.
>
> Remove the unnecessary function call to gpiochip_remove().
> No GPIO cleanup is required because the GPIO chip
> has not yet been registered. Without this change there
> is potential for a kernel panic upon registration failure
>
> Fixes: 266423e60ea1 ("pinctrl: bcm2835: Change init order for gpio hogs")
> Signed-off-by: Daniel McCarthy <daniel at dragonzap.com>
Patch applied as nonurgent fix.
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list