summaryrefslogtreecommitdiff
path: root/kernel/power/disk.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2005-10-30 14:59:58 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 17:37:14 -0800
commit2c1b4a5ca48831595979a850f40ced8e7da026f8 (patch)
tree06fe8a400df8c5166c7f47ca2c30a584473f1170 /kernel/power/disk.c
parenta0f496517f3e28d651d0cbbcf2d4fb701ed6957e (diff)
[PATCH] swsusp: rework memory freeing on resume
The following patch makes swsusp use the PG_nosave and PG_nosave_free flags to mark pages that should be freed in case of an error during resume. This allows us to simplify the code and to use swsusp_free() in all of the swsusp's resume error paths, which makes them actually work. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r--kernel/power/disk.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 761956e813f5..44ef5e799df0 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -30,7 +30,6 @@ extern int swsusp_check(void);
extern int swsusp_read(void);
extern void swsusp_close(void);
extern int swsusp_resume(void);
-extern int swsusp_free(void);
static int noresume = 0;
@@ -252,14 +251,17 @@ static int software_resume(void)
pr_debug("PM: Reading swsusp image.\n");
- if ((error = swsusp_read()))
- goto Cleanup;
+ if ((error = swsusp_read())) {
+ swsusp_free();
+ goto Thaw;
+ }
pr_debug("PM: Preparing devices for restore.\n");
if ((error = device_suspend(PMSG_FREEZE))) {
printk("Some devices failed to suspend\n");
- goto Free;
+ swsusp_free();
+ goto Thaw;
}
mb();
@@ -268,9 +270,7 @@ static int software_resume(void)
swsusp_resume();
pr_debug("PM: Restore failed, recovering.n");
device_resume();
- Free:
- swsusp_free();
- Cleanup:
+ Thaw:
unprepare_processes();
Done:
/* For success case, the suspend path will release the lock */