]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: omap: Fix an error handling path in omap_i2c_probe()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 5 Jul 2025 07:57:38 +0000 (09:57 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Thu, 10 Jul 2025 09:58:33 +0000 (11:58 +0200)
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>
Cc: <stable@vger.kernel.org> # v5.13+
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/af8a9b62996bebbaaa7c02986aa2a8325ef11596.1751701715.git.christophe.jaillet@wanadoo.fr
drivers/i2c/busses/i2c-omap.c

index 17db58195c06ead3b092c4ac96882ecc02a7e841..5fcc9f6c33e5b236819c176fa2cf1c5631261e1b 100644 (file)
@@ -1521,9 +1521,9 @@ err_mux_state_deselect:
        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;