summaryrefslogtreecommitdiffstats
path: root/drivers/base/power/main.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2013-11-13 15:45:03 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-11-14 00:48:19 +0100
commitaa1b9f13b3346352455bfdc343ecff7667b84ff5 (patch)
tree03974c3bb35582ce372d66b6017413146c7e2be1 /drivers/base/power/main.c
parentPM / Runtime: Update documentation around probe|remove|suspend (diff)
downloadlinux-aa1b9f13b3346352455bfdc343ecff7667b84ff5.tar.xz
linux-aa1b9f13b3346352455bfdc343ecff7667b84ff5.zip
PM / Runtime: Fix error path for prepare
If a device prepare callback for some reason would fail, the PM core prevented the device from going inactive forever. In this case, to reverse the pm_runtime_get_noresume() we invokes the asyncronous pm_runtime_put(), thus restoring the usage count. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r--drivers/base/power/main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 9f098a82cf04..97db7552e90a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1277,6 +1277,9 @@ static int device_prepare(struct device *dev, pm_message_t state)
device_unlock(dev);
+ if (error)
+ pm_runtime_put(dev);
+
return error;
}