* Cleanup event.c and warn about bug
@ 2004-10-04 12:59 Pavel Machek
0 siblings, 0 replies; only message in thread
From: Pavel Machek @ 2004-10-04 12:59 UTC (permalink / raw)
To: Len Brown, ACPI mailing list, Andrew Morton,
Rusty trivial patch monkey Russell
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-10-04 12:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-04 12:59 Cleanup event.c and warn about bug Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox