]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mmc: sdhci-esdhc-imx: use pm_runtime_resume_and_get() in suspend
authorLuke Wang <ziniu.wang_1@nxp.com>
Wed, 15 Jul 2026 07:18:16 +0000 (15:18 +0800)
committerUlf Hansson <ulfh@kernel.org>
Wed, 15 Jul 2026 08:59:50 +0000 (10:59 +0200)
Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() to
simplify error handling. pm_runtime_resume_and_get() automatically
drops the usage counter on failure, avoiding the need for a separate
pm_runtime_put_noidle() call. If it fails, the device is unclocked and
accessing hardware registers would cause a kernel panic, so return the
error immediately.

Fixes: 676a83855614 ("mmc: host: sdhci-esdhc-imx: refactor the system PM logic")
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
drivers/mmc/host/sdhci-esdhc-imx.c

index d980dea9cad1f13906bea46a17e7a71d4762a655..7818f351a58aeb1647db69a655ccb5df68d52554 100644 (file)
@@ -2061,7 +2061,9 @@ static int sdhci_esdhc_suspend(struct device *dev)
         * 2, make sure the pm_runtime_force_resume() in sdhci_esdhc_resume() really
         *    invoke its ->runtime_resume callback (needs_force_resume = 1).
         */
-       pm_runtime_get_sync(dev);
+       ret = pm_runtime_resume_and_get(dev);
+       if (ret)
+               return ret;
 
        if ((imx_data->socdata->flags & ESDHC_FLAG_STATE_LOST_IN_LPMODE) &&
                (host->tuning_mode != SDHCI_TUNING_MODE_1)) {