diff options
author | Pavel Machek <pavel@ucw.cz> | 2005-07-07 20:56:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-07 21:23:43 -0400 |
commit | 47b724f3fe372a3d9acf0bb560fb5c93c9867880 (patch) | |
tree | bbb6cf40166e0be65cf5589a6b1d46e732df1f47 | |
parent | 3efa147ad7608196639882ba4075b376f306fe16 (diff) |
[PATCH] swsusp: fix error handling
Fix error handling and whitespace in swsusp.c. swsusp_free() was called when
there was nothing allocating, leading to oops.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | kernel/power/swsusp.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index d82c1f7d0a60..7d7801cd01f0 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
@@ -869,13 +869,6 @@ extern asmlinkage int swsusp_arch_resume(void); | |||
869 | 869 | ||
870 | asmlinkage int swsusp_save(void) | 870 | asmlinkage int swsusp_save(void) |
871 | { | 871 | { |
872 | int error = 0; | ||
873 | |||
874 | if ((error = swsusp_swap_check())) { | ||
875 | printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try " | ||
876 | "swapon -a!\n"); | ||
877 | return error; | ||
878 | } | ||
879 | return suspend_prepare_image(); | 872 | return suspend_prepare_image(); |
880 | } | 873 | } |
881 | 874 | ||
@@ -892,14 +885,20 @@ int swsusp_suspend(void) | |||
892 | * at resume time, and evil weirdness ensues. | 885 | * at resume time, and evil weirdness ensues. |
893 | */ | 886 | */ |
894 | if ((error = device_power_down(PMSG_FREEZE))) { | 887 | if ((error = device_power_down(PMSG_FREEZE))) { |
895 | printk(KERN_ERR "Some devices failed to power down, aborting suspend\n"); | ||
896 | local_irq_enable(); | 888 | local_irq_enable(); |
897 | swsusp_free(); | ||
898 | return error; | 889 | return error; |
899 | } | 890 | } |
891 | |||
892 | if ((error = swsusp_swap_check())) { | ||
893 | printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try " | ||
894 | "swapon -a!\n"); | ||
895 | local_irq_enable(); | ||
896 | return error; | ||
897 | } | ||
898 | |||
900 | save_processor_state(); | 899 | save_processor_state(); |
901 | if ((error = swsusp_arch_suspend())) | 900 | if ((error = swsusp_arch_suspend())) |
902 | swsusp_free(); | 901 | printk("Error %d suspending\n", error); |
903 | /* Restore control flow magically appears here */ | 902 | /* Restore control flow magically appears here */ |
904 | restore_processor_state(); | 903 | restore_processor_state(); |
905 | BUG_ON (nr_copy_pages_check != nr_copy_pages); | 904 | BUG_ON (nr_copy_pages_check != nr_copy_pages); |
@@ -1166,9 +1165,9 @@ static int bio_write_page(pgoff_t page_off, void * page) | |||
1166 | static const char * sanity_check(void) | 1165 | static const char * sanity_check(void) |
1167 | { | 1166 | { |
1168 | dump_info(); | 1167 | dump_info(); |
1169 | if(swsusp_info.version_code != LINUX_VERSION_CODE) | 1168 | if (swsusp_info.version_code != LINUX_VERSION_CODE) |
1170 | return "kernel version"; | 1169 | return "kernel version"; |
1171 | if(swsusp_info.num_physpages != num_physpages) | 1170 | if (swsusp_info.num_physpages != num_physpages) |
1172 | return "memory size"; | 1171 | return "memory size"; |
1173 | if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname)) | 1172 | if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname)) |
1174 | return "system type"; | 1173 | return "system type"; |