Re: [PATCH] pinctrl: pinctrl-pic32: Fix resource leaks

From: Linus Walleij

Date: Thu Feb 26 2026 - 17:38:25 EST


Hi Ethan,

thanks for your patch!

On Tue, Feb 24, 2026 at 9:29 PM Ethan Tidmore <ethantidmore06@xxxxxxxxx> wrote:

> Add three missing clk_disable_unprepare() in early return error paths.
>
> Detected by Smatch:
> drivers/pinctrl/pinctrl-pic32.c:2211 pic32_pinctrl_probe() warn:
> 'pctl->clk' from clk_prepare_enable() not released on lines: 2208.
>
> drivers/pinctrl/pinctrl-pic32.c:2274 pic32_gpio_probe() warn:
> 'bank->clk' from clk_prepare_enable() not released on lines: 2264,2272.
>
> Fixes: 2ba384e6c3810 ("pinctrl: pinctrl-pic32: Add PIC32 pin control driver")
> Signed-off-by: Ethan Tidmore <ethantidmore06@xxxxxxxxx>
(...)
> if (IS_ERR(pctl->pctldev)) {
> + clk_disable_unprepare(pctl->clk);
(...)
> + goto err_clk_cleanup;
(...)
> + goto err_clk_cleanup;
> +err_clk_cleanup:
> + clk_disable_unprepare(bank->clk);
> + return ret;

Can't you just use devm_clk_get_enabled() and let devres do this?

Yours,
Linus Walleij