mmc: sdhci_am654: Properly handle failures in .remove()
authorYangtao Li <frank.li@vivo.com>
Thu, 27 Jul 2023 07:00:48 +0000 (15:00 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 15 Aug 2023 10:48:21 +0000 (12:48 +0200)
Returning an error code in a platform driver's remove function is wrong
most of the time and there is an effort to make the callback return
void. To prepare this rework the function not to exit early.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20230727070051.17778-59-frank.li@vivo.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci_am654.c

index 7cdf0f54e3a50d4b01e6ee9552e13561ed15c958..1cc84739ef2f2ffdffa4f2cb85ce20733f91e822 100644 (file)
@@ -870,16 +870,17 @@ static int sdhci_am654_remove(struct platform_device *pdev)
 {
        struct sdhci_host *host = platform_get_drvdata(pdev);
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+       struct device *dev = &pdev->dev;
        int ret;
 
-       ret = pm_runtime_resume_and_get(&pdev->dev);
+       ret = pm_runtime_get_sync(dev);
        if (ret < 0)
-               return ret;
+               dev_err(dev, "pm_runtime_get_sync() Failed\n");
 
        sdhci_remove_host(host, true);
        clk_disable_unprepare(pltfm_host->clk);
-       pm_runtime_disable(&pdev->dev);
-       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_disable(dev);
+       pm_runtime_put_noidle(dev);
        sdhci_pltfm_free(pdev);
        return 0;
 }