[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>
This commit is contained in:
parent
3efa147ad7
commit
47b724f3fe
@ -869,13 +869,6 @@ extern asmlinkage int swsusp_arch_resume(void);
|
|||||||
|
|
||||||
asmlinkage int swsusp_save(void)
|
asmlinkage int swsusp_save(void)
|
||||||
{
|
{
|
||||||
int error = 0;
|
|
||||||
|
|
||||||
if ((error = swsusp_swap_check())) {
|
|
||||||
printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try "
|
|
||||||
"swapon -a!\n");
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
return suspend_prepare_image();
|
return suspend_prepare_image();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,14 +885,20 @@ int swsusp_suspend(void)
|
|||||||
* at resume time, and evil weirdness ensues.
|
* at resume time, and evil weirdness ensues.
|
||||||
*/
|
*/
|
||||||
if ((error = device_power_down(PMSG_FREEZE))) {
|
if ((error = device_power_down(PMSG_FREEZE))) {
|
||||||
printk(KERN_ERR "Some devices failed to power down, aborting suspend\n");
|
|
||||||
local_irq_enable();
|
local_irq_enable();
|
||||||
swsusp_free();
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((error = swsusp_swap_check())) {
|
||||||
|
printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try "
|
||||||
|
"swapon -a!\n");
|
||||||
|
local_irq_enable();
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
save_processor_state();
|
save_processor_state();
|
||||||
if ((error = swsusp_arch_suspend()))
|
if ((error = swsusp_arch_suspend()))
|
||||||
swsusp_free();
|
printk("Error %d suspending\n", error);
|
||||||
/* Restore control flow magically appears here */
|
/* Restore control flow magically appears here */
|
||||||
restore_processor_state();
|
restore_processor_state();
|
||||||
BUG_ON (nr_copy_pages_check != nr_copy_pages);
|
BUG_ON (nr_copy_pages_check != nr_copy_pages);
|
||||||
|
Loading…
Reference in New Issue
Block a user