[PATCH] pinctrl: spear: plgpio: Unregister the GPIO chip on removal

Linus Walleij linusw at kernel.org
Tue Dec 1 12:48:16 PST 2026


On Mon, Nov 30, 2026 at 9:42 AM Viresh Kumar <viresh.kumar at linaro.org> wrote:
> On 28-11-26, 19:02, Tian Xuechen wrote:
> > From: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
> >
> > Device removal frees the PLGPIO state while its embedded GPIO chip
> > remains registered. Use managed registration so gpiolib drops the
> > chip first.
> >
> > This issue was found by our static analysis tool under development.
> >
> > Fixes: 604bb7da7780 ("pinctrl: SPEAr: Add plgpio driver")
> > Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
> > ---
> >  drivers/pinctrl/spear/pinctrl-plgpio.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
> > index b5fc76e114be..b17df26c82b1 100644
> > --- a/drivers/pinctrl/spear/pinctrl-plgpio.c
> > +++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
> > @@ -612,7 +612,7 @@ static int plgpio_probe(struct platform_device *pdev)
> >               dev_info(&pdev->dev, "PLGPIO registering without IRQs\n");
> >       }
> >
> > -     ret = gpiochip_add_data(&plgpio->chip, plgpio);
> > +     ret = devm_gpiochip_add_data(&pdev->dev, &plgpio->chip, plgpio);
> >       if (ret) {
> >               dev_err(&pdev->dev, "unable to add gpio chip\n");
> >               goto unprepare_clk;
>
> This driver doesn't have a remove path at all and can't be built as a module and
> so didn't use the devm_ variant.

The AI tools have found the unbind feature in sysfs
and is now on a mission to fix that theoretical problem
in the entire kernel :/

The commit message should specify how to provoke
this problem.

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list