Skip to contentSkip to conversation

acpi proc: simplify error handling

PATCH Pavel Machek 2 participants 2 messages Sep 10, 2004 – Sep 11, 2004 1 message not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

Hi!

This simplifies error handling in acpi/sleep/proc.c. Please apply,

Pavel

drivers/acpi/sleep/proc.c +5 -5
@@ -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

A message that is not in the archive (sent off-list or not yet received): 20040910085949.GA14198-I/[email protected]

#2 lore raw
Quoted 3 lines · Pavel Machek

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.

Quoted 1 line

Please apply,

I second this :-)

Signature · 9 lines
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