From: Al Viro <viro@ftp.linux.org.uk>
To: Richard Purdie <rpurdie@rpsys.net>
Cc: Trent Piepho <xyzzy@speakeasy.org>,
Michal Piotrowski <michal.k.k.piotrowski@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
acpi4asus-u@pimp.vs19.net, Gabriel C <nix.or.die@googlemail.com>,
Corentin Chary <corentincj@iksaif.net>,
Andreas Gruenbacher <agruen@suse.de>
Subject: Re: [1/2] 2.6.23-rc1: known regressions
Date: Mon, 23 Jul 2007 14:36:00 +0100 [thread overview]
Message-ID: <20070723133600.GI21668@ftp.linux.org.uk> (raw)
In-Reply-To: <1185196327.6148.51.camel@localhost.localdomain>
On Mon, Jul 23, 2007 at 02:12:07PM +0100, Richard Purdie wrote:
> Fix the leak where asus-led registration fails half way through.
Frankly, I don't think that any post-factum checks are needed. We
should just bail out at the point of failure. See the patch posted
earlier... BTW, your variant does destroy_workqueue() when no
create_singlethreaded_workqueue() had been called. FWIW, here's
the patch I'm talking about:
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index f753060..6b89854 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -1067,19 +1067,16 @@ static void asus_backlight_exit(void)
}
#define ASUS_LED_UNREGISTER(object) \
- if(object##_led.class_dev \
- && !IS_ERR(object##_led.class_dev)) \
- led_classdev_unregister(&object##_led)
+ led_classdev_unregister(&object##_led)
static void asus_led_exit(void)
{
+ destroy_workqueue(led_workqueue);
ASUS_LED_UNREGISTER(mled);
ASUS_LED_UNREGISTER(tled);
ASUS_LED_UNREGISTER(pled);
ASUS_LED_UNREGISTER(rled);
ASUS_LED_UNREGISTER(gled);
-
- destroy_workqueue(led_workqueue);
}
static void __exit asus_laptop_exit(void)
@@ -1135,29 +1132,42 @@ static int asus_led_init(struct device *dev)
rv = ASUS_LED_REGISTER(mled, dev);
if (rv)
- return rv;
+ goto out;
rv = ASUS_LED_REGISTER(tled, dev);
if (rv)
- return rv;
+ goto out1;
rv = ASUS_LED_REGISTER(rled, dev);
if (rv)
- return rv;
+ goto out2;
rv = ASUS_LED_REGISTER(pled, dev);
if (rv)
- return rv;
+ goto out3;
rv = ASUS_LED_REGISTER(gled, dev);
if (rv)
- return rv;
+ goto out4;
led_workqueue = create_singlethread_workqueue("led_workqueue");
if (!led_workqueue)
- return -ENOMEM;
+ goto out5;
return 0;
+out5:
+ rv = -ENOMEM;
+ ASUS_LED_UNREGISTER(gled);
+out4:
+ ASUS_LED_UNREGISTER(pled);
+out3:
+ ASUS_LED_UNREGISTER(rled);
+out2:
+ ASUS_LED_UNREGISTER(tled);
+out1:
+ ASUS_LED_UNREGISTER(mled);
+out:
+ return rv;
}
static int __init asus_laptop_init(void)
--
1.5.3.GIT
next prev parent reply other threads:[~2007-07-23 13:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 9:47 [1/2] 2.6.23-rc1: known regressions Michal Piotrowski
2007-07-23 10:21 ` Al Viro
2007-07-23 11:17 ` Trent Piepho
2007-07-23 11:25 ` Al Viro
2007-07-23 13:12 ` Richard Purdie
2007-07-23 13:36 ` Al Viro [this message]
2007-07-23 14:32 ` Richard Purdie
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=20070723133600.GI21668@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=acpi4asus-u@pimp.vs19.net \
--cc=agruen@suse.de \
--cc=corentincj@iksaif.net \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.k.k.piotrowski@gmail.com \
--cc=nix.or.die@googlemail.com \
--cc=rpurdie@rpsys.net \
--cc=xyzzy@speakeasy.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