public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	ACPI mailing list
	<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Andrew Morton <akpm-LJ1TwQYPT6cQrrorzV6ljw@public.gmane.org>,
	Rusty trivial patch monkey Russell
	<trivial-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
Subject: Cleanup event.c and warn about bug
Date: Mon, 4 Oct 2004 14:59:21 +0200	[thread overview]
Message-ID: <20041004125921.GA2704@elf.ucw.cz> (raw)

Hi!

event.c contains some completely unneccessary gotos, and is not
reentrant as it needs to be. Fix gotos, warn about reentrancy.
Please apply,
							Pavel

Index: linux/drivers/acpi/event.c
===================================================================
--- linux.orig/drivers/acpi/event.c	2004-10-01 12:24:26.000000000 +0200
+++ linux/drivers/acpi/event.c	2004-06-22 12:37:56.000000000 +0200
@@ -24,19 +24,14 @@
 static int
 acpi_system_open_event(struct inode *inode, struct file *file)
 {
+	int retval = 0;
 	spin_lock_irq (&acpi_system_event_lock);
-
-	if(event_is_open)
-		goto out_busy;
-
-	event_is_open = 1;
-
-	spin_unlock_irq (&acpi_system_event_lock);
-	return 0;
-
-out_busy:
+	if (event_is_open)
+		retval = -EBUSY;
+	else
+		event_is_open = 1;
 	spin_unlock_irq (&acpi_system_event_lock);
-	return -EBUSY;
+	return retval;
 }
 
 static ssize_t
@@ -48,7 +43,7 @@
 {
 	int			result = 0;
 	struct acpi_bus_event	event;
-	static char		str[ACPI_MAX_STRING];
+	static char		str[ACPI_MAX_STRING];		/* That's joke, right?! What if two threads read from it at the same time? */
 	static int		chars_remaining = 0;
 	static char		*ptr;
 

-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

                 reply	other threads:[~2004-10-04 12:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20041004125921.GA2704@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 \
    --cc=trivial-8n+1lVoiYb80n/F98K4Iww@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