Re: [PATCH] gpio: omap: do not unprepare the debounce clock twice on probe failure
From: Andreas Kemnade
Date: Tue Nov 24 2026 - 04:30:23 EST
On Tue, 24 Nov 2026 15:52:31 +0700
Cong Nguyen <congnt264@xxxxxxxxx> wrote:
> The debounce clock is now obtained with devm_clk_get_prepared(), so
> devres unprepares it when probe fails or the device is unbound. The error
> path added for a failing pm_runtime_resume_and_get() still calls
> clk_unprepare() on the same clock by hand.
>
> When pm_runtime_resume_and_get() fails and a debounce clock is present,
> the clock is unprepared twice. The second clk_unprepare() warns that the
> clock is already unprepared.
>
> Drop the manual clk_unprepare().
>
> This issue was found by auditing the driver with an LLM coding assistant.
>
> Fixes: 9df982f1f283 ("gpio: omap: handle debounce clock preparation failure")
> Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>
Reviewed-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>
> ---
> drivers/gpio/gpio-omap.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index 0da628ae77be..0af26c3f7197 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1463,8 +1463,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
> ret = pm_runtime_resume_and_get(dev);
> if (ret < 0) {
> pm_runtime_disable(dev);
> - if (bank->dbck_flag)
> - clk_unprepare(bank->dbck);
> return ret;
> }
>