[PATCH] pinctrl: st: Remove the GPIO banks on teardown
Patrice CHOTARD
patrice.chotard at foss.st.com
Sun Nov 29 23:29:49 PST 2026
On 11/29/26 10:47, Tian Xuechen wrote:
> From: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
>
> Each bank publishes a GPIO chip backed by managed storage. A later
> probe failure or driver removal frees that storage with the chip
> still registered. Manage each GPIO registration with the device.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: 701016c0cba5 ("pinctrl: st: Add pinctrl and pinconf support.")
> Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
> ---
> drivers/pinctrl/pinctrl-st.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
> index dc23599764e2..6886fcb37977 100644
> --- a/drivers/pinctrl/pinctrl-st.c
> +++ b/drivers/pinctrl/pinctrl-st.c
> @@ -1565,7 +1565,7 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info,
> }
>
> skip_irq:
> - err = gpiochip_add_data(&bank->gpio_chip, bank);
> + err = devm_gpiochip_add_data(dev, &bank->gpio_chip, bank);
> if (err)
> return dev_err_probe(dev, err, "Failed to add gpiochip(%d)!\n", bank_num);
> dev_info(dev, "%s bank added.\n", range->name);
>
> base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5
Hi Tian
Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>
Thanks
Patrice
More information about the linux-arm-kernel
mailing list