mmc: core: call pm_runtime_put_noidle in pm_runtime_get_sync failed case
authorLi Fei <fei.li@intel.com>
Mon, 8 Apr 2013 01:36:39 +0000 (09:36 +0800)
committerChris Ball <cjb@laptop.org>
Fri, 12 Apr 2013 18:15:04 +0000 (14:15 -0400)
Even in failed case of pm_runtime_get_sync, the usage_count
is incremented. In order to keep the usage_count with correct
value and runtime power management to behave correctly, call
pm_runtime_put_noidle in such case.

Signed-off-by: Liu Chuansheng <chuansheng.liu@intel.com>
Signed-off-by: Li Fei <fei.li@intel.com>
Acked-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/sdio.c
drivers/mmc/core/sdio_bus.c

index aa0719a..6889a82 100644 (file)
@@ -861,8 +861,10 @@ static void mmc_sdio_detect(struct mmc_host *host)
        /* Make sure card is powered before detecting it */
        if (host->caps & MMC_CAP_POWER_OFF_CARD) {
                err = pm_runtime_get_sync(&host->card->dev);
-               if (err < 0)
+               if (err < 0) {
+                       pm_runtime_put_noidle(&host->card->dev);
                        goto out;
+               }
        }
 
        mmc_claim_host(host);
index 8d6bb18..546c67c 100644 (file)
@@ -138,7 +138,7 @@ static int sdio_bus_probe(struct device *dev)
        if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) {
                ret = pm_runtime_get_sync(dev);
                if (ret < 0)
-                       goto out;
+                       goto disable_runtimepm;
        }
 
        /* Set the default block size so the driver is sure it's something
@@ -158,7 +158,6 @@ static int sdio_bus_probe(struct device *dev)
 disable_runtimepm:
        if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD)
                pm_runtime_put_noidle(dev);
-out:
        return ret;
 }