* acpi proc: simplify error handling
@ 2004-09-10 8:59 Pavel Machek
[not found] ` <20040910085949.GA14198-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2004-09-10 8:59 UTC (permalink / raw)
To: ACPI mailing list, Andrew Morton, Len Brown
Hi!
This simplifies error handling in acpi/sleep/proc.c. Please apply,
Pavel
--- clean-mm/drivers/acpi/sleep/proc.c 2004-08-24 09:03:14.000000000 +0200
+++ linux-mm/drivers/acpi/sleep/proc.c 2004-09-07 21:15:19.000000000 +0200
@@ -57,7 +57,8 @@
int error = 0;
if (count > sizeof(str) - 1)
- goto Done;
+ return -EIO;
+
memset(str,0,sizeof(str));
if (copy_from_user(str, buffer, count))
return -EFAULT;
@@ -65,17 +66,16 @@
/* Check for S4 bios request */
if (!strcmp(str,"4b")) {
error = acpi_suspend(4);
- goto Done;
+ return error ? error : count;
}
state = simple_strtoul(str, NULL, 0);
#ifdef CONFIG_SOFTWARE_SUSPEND
if (state == 4) {
- software_suspend();
- goto Done;
+ error = software_suspend();
+ return error ? error : count;
}
#endif
error = acpi_suspend(state);
- Done:
return error ? error : count;
}
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: acpi proc: simplify error handling
[not found] ` <20040910085949.GA14198-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
@ 2004-09-11 10:16 ` Stefan Seyfried
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Seyfried @ 2004-09-11 10:16 UTC (permalink / raw)
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Fri, Sep 10, 2004 at 10:59:49AM +0200, Pavel Machek wrote:
> Hi!
>
> This simplifies error handling in acpi/sleep/proc.c.
Even more important: now we get an error if "echo $X > /proc/acpi/sleep"
fails, e.g. suspend to disk never gets to power off the machine because
of missing swap or not enough free pages.
Without this, userspace cannot tell if suspend succeeded or failed.
> Please apply,
I second this :-)
--
Stefan Seyfried
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-09-11 10:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-10 8:59 acpi proc: simplify error handling Pavel Machek
[not found] ` <20040910085949.GA14198-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-09-11 10:16 ` Stefan Seyfried
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox