public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: ACPI mailing list
	<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Andrew Morton <akpm-LJ1TwQYPT6cQrrorzV6ljw@public.gmane.org>,
	Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: acpi proc: simplify error handling
Date: Fri, 10 Sep 2004 10:59:49 +0200	[thread overview]
Message-ID: <20040910085949.GA14198@elf.ucw.cz> (raw)

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

             reply	other threads:[~2004-09-10  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-10  8:59 Pavel Machek [this message]
     [not found] ` <20040910085949.GA14198-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-09-11 10:16   ` acpi proc: simplify error handling Stefan Seyfried

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040910085949.GA14198@elf.ucw.cz \
    --to=pavel-+zi9xunit7i@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=akpm-LJ1TwQYPT6cQrrorzV6ljw@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox