]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i2c: imx-lpi2c: Fix clock count when probe defers
authorClark Wang <xiaoning.wang@nxp.com>
Mon, 21 Apr 2025 06:23:41 +0000 (14:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:36:51 +0000 (14:36 +0200)
commit b1852c5de2f2a37dd4462f7837c9e3e678f9e546 upstream.

Deferred probe with pm_runtime_put() may delay clock disable, causing
incorrect clock usage count. Use pm_runtime_put_sync() to ensure the
clock is disabled immediately.

Fixes: 13d6eb20fc79 ("i2c: imx-lpi2c: add runtime pm support")
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Cc: <stable@vger.kernel.org> # v4.16+
Link: https://lore.kernel.org/r/20250421062341.2471922-1-carlos.song@nxp.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-imx-lpi2c.c

index c688f11ae5c9f6db3fbf0eb135c1c332fa5c4e48..96a4ce9c8d258fbd4459131d7c0d1fdc34c50771 100644 (file)
@@ -616,9 +616,9 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
        return 0;
 
 rpm_disable:
-       pm_runtime_put(&pdev->dev);
-       pm_runtime_disable(&pdev->dev);
        pm_runtime_dont_use_autosuspend(&pdev->dev);
+       pm_runtime_put_sync(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
 
        return ret;
 }