* [patch] swsusp: fix error handling
@ 2005-07-03 21:56 Pavel Machek
2005-07-04 6:37 ` Stefan Seyfried
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2005-07-03 21:56 UTC (permalink / raw)
To: Andrew Morton, kernel list
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>
---
commit 674f73c9711fdc86c9c60adfefd5f88b32691edf
tree 5a28fb2543e0d012022c82dc7028991abd860c71
parent b532d863c3fd0a6ee5def139cd1131a80b8c4a36
author <pavel@amd.(none)> Sun, 03 Jul 2005 23:56:16 +0200
committer <pavel@amd.(none)> Sun, 03 Jul 2005 23:56:16 +0200
kernel/power/swsusp.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -975,13 +975,6 @@ extern asmlinkage int swsusp_arch_resume
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();
}
@@ -998,14 +991,20 @@ int swsusp_suspend(void)
* at resume time, and evil weirdness ensues.
*/
if ((error = device_power_down(PMSG_FREEZE))) {
- printk(KERN_ERR "Some devices failed to power down, aborting suspend\n");
local_irq_enable();
- swsusp_free();
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();
if ((error = swsusp_arch_suspend()))
- swsusp_free();
+ printk("Error %d suspending\n", error);
/* Restore control flow magically appears here */
restore_processor_state();
BUG_ON (nr_copy_pages_check != nr_copy_pages);
@@ -1272,9 +1271,9 @@ static int bio_write_page(pgoff_t page_o
static const char * sanity_check(void)
{
dump_info();
- if(swsusp_info.version_code != LINUX_VERSION_CODE)
+ if (swsusp_info.version_code != LINUX_VERSION_CODE)
return "kernel version";
- if(swsusp_info.num_physpages != num_physpages)
+ if (swsusp_info.num_physpages != num_physpages)
return "memory size";
if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname))
return "system type";
--
teflon -- maybe it is a trademark, but it should not be.
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch] swsusp: fix error handling
2005-07-03 21:56 [patch] swsusp: fix error handling Pavel Machek
@ 2005-07-04 6:37 ` Stefan Seyfried
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Seyfried @ 2005-07-04 6:37 UTC (permalink / raw)
To: linux-kernel
Pavel Machek wrote:
> --- a/kernel/power/swsusp.c
> +++ b/kernel/power/swsusp.c
> @@ -998,14 +991,20 @@ int swsusp_suspend(void)
> * at resume time, and evil weirdness ensues.
> */
> if ((error = device_power_down(PMSG_FREEZE))) {
> - printk(KERN_ERR "Some devices failed to power down, aborting suspend\n");
i don't like this one. Silent failures are a major PITA.
> + printk("Error %d suspending\n", error);
therefor i like this one ;-) Maybe with a printk level?
--
Stefan Seyfried \ "I didn't want to write for pay. I
QA / R&D Team Mobile Devices \ wanted to be paid for what I write."
SUSE LINUX Products GmbH, Nürnberg \ -- Leonard Cohen
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-07-04 7:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-03 21:56 [patch] swsusp: fix error handling Pavel Machek
2005-07-04 6:37 ` Stefan Seyfried
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.