Am Sat, 5 Jul 2025 09:57:38 +0200
schrieb Christophe JAILLET <christophe.jaillet@wanadoo.fr>:
> If an error occurs after pm_runtime_use_autosuspend(), a corresponding
> pm_runtime_dont_use_autosuspend() should be called.
>
> In case of error in pm_runtime_resume_and_get(), it is not the case because
> the error handling path is wrongly ordered.
> Fix it.
>
> Fixes: 780f62974125 ("i2c: omap: fix reference leak when pm_runtime_get_sync fails")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> Compile tested only.
> ---
> drivers/i2c/busses/i2c-omap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 485313d872e5..ef1193e0e62d 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1523,9 +1523,9 @@ omap_i2c_probe(struct platform_device *pdev)
> if (omap->mux_state)
> mux_state_deselect(omap->mux_state);
> err_put_pm:
> - pm_runtime_dont_use_autosuspend(omap->dev);
> pm_runtime_put_sync(omap->dev);
> err_disable_pm:
> + pm_runtime_dont_use_autosuspend(omap->dev);
> pm_runtime_disable(&pdev->dev);
>
> return r;