aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-04-18 17:58:59 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-04-18 17:58:59 -0400
commit2ca6f62f595c01f689b269db6736de5544da7667 (patch)
treebfc4b2225ea1df64542c92dd8336420515072faa /kernel
parenta1b49cb7e2a7961ec3aa8b64860bf480d4ec9077 (diff)
PM: Fix error code paths executed after failing syscore_suspend()
If syscore_suspend() fails in suspend_enter(), create_image() or resume_target_kernel(), it is necessary to call sysdev_resume(), because sysdev_suspend() has been called already and succeeded and we are going to abort the transition. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/hibernate.c10
-rw-r--r--kernel/power/suspend.c5
2 files changed, 12 insertions, 3 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index aeabd26e3342..50aae660174d 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -273,8 +273,11 @@ static int create_image(int platform_mode)
273 local_irq_disable(); 273 local_irq_disable();
274 274
275 error = sysdev_suspend(PMSG_FREEZE); 275 error = sysdev_suspend(PMSG_FREEZE);
276 if (!error) 276 if (!error) {
277 error = syscore_suspend(); 277 error = syscore_suspend();
278 if (error)
279 sysdev_resume();
280 }
278 if (error) { 281 if (error) {
279 printk(KERN_ERR "PM: Some system devices failed to power down, " 282 printk(KERN_ERR "PM: Some system devices failed to power down, "
280 "aborting hibernation\n"); 283 "aborting hibernation\n");
@@ -407,8 +410,11 @@ static int resume_target_kernel(bool platform_mode)
407 local_irq_disable(); 410 local_irq_disable();
408 411
409 error = sysdev_suspend(PMSG_QUIESCE); 412 error = sysdev_suspend(PMSG_QUIESCE);
410 if (!error) 413 if (!error) {
411 error = syscore_suspend(); 414 error = syscore_suspend();
415 if (error)
416 sysdev_resume();
417 }
412 if (error) 418 if (error)
413 goto Enable_irqs; 419 goto Enable_irqs;
414 420
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 2814c32aed51..8935369d503a 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -164,8 +164,11 @@ static int suspend_enter(suspend_state_t state)
164 BUG_ON(!irqs_disabled()); 164 BUG_ON(!irqs_disabled());
165 165
166 error = sysdev_suspend(PMSG_SUSPEND); 166 error = sysdev_suspend(PMSG_SUSPEND);
167 if (!error) 167 if (!error) {
168 error = syscore_suspend(); 168 error = syscore_suspend();
169 if (error)
170 sysdev_resume();
171 }
169 if (!error) { 172 if (!error) {
170 if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { 173 if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) {
171 error = suspend_ops->enter(state); 174 error = suspend_ops->enter(state);