diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2016-04-08 07:10:23 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-04-21 13:31:11 -0400 |
commit | 0ae3aeefabbeef26294e7a349b51f1c761d46c9f (patch) | |
tree | 0aa249f1af5a84c84d0c555a1b140c609cb01cfb | |
parent | 16669befb0772eac6a76057b7010ba5b419c0e78 (diff) |
PM / Runtime: Fix error path in pm_runtime_force_resume()
As pm_runtime_set_active() may fail because the device's parent isn't
active, we can end up executing the ->runtime_resume() callback for the
device when it isn't allowed.
Fix this by invoking pm_runtime_set_active() before running the callback
and let's also deal with the error code.
Fixes: 37f204164dfb (PM: Add pm_runtime_suspend|resume_force functions)
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/base/power/runtime.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 4c7055009bd6..b74690418504 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -1506,11 +1506,16 @@ int pm_runtime_force_resume(struct device *dev) | |||
1506 | goto out; | 1506 | goto out; |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | ret = callback(dev); | 1509 | ret = pm_runtime_set_active(dev); |
1510 | if (ret) | 1510 | if (ret) |
1511 | goto out; | 1511 | goto out; |
1512 | 1512 | ||
1513 | pm_runtime_set_active(dev); | 1513 | ret = callback(dev); |
1514 | if (ret) { | ||
1515 | pm_runtime_set_suspended(dev); | ||
1516 | goto out; | ||
1517 | } | ||
1518 | |||
1514 | pm_runtime_mark_last_busy(dev); | 1519 | pm_runtime_mark_last_busy(dev); |
1515 | out: | 1520 | out: |
1516 | pm_runtime_enable(dev); | 1521 | pm_runtime_enable(dev); |