From: Ulf Hansson Date: Wed, 13 Nov 2013 14:45:03 +0000 (+0100) Subject: PM / Runtime: Fix error path for prepare X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=aa1b9f13b3346352455bfdc343ecff7667b84ff5;p=linux-beck.git 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 Signed-off-by: Rafael J. Wysocki --- 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; }