From: Dave Hansen <dave@sr71.net>
To: Axel Lin <axel.lin@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Rodney Girod <rgirod@confocus.com>,
Richard Purdie <rpurdie@linux.intel.com>
Subject: Re: [PATCH] leds-ss4200: fix led_classdev_unregister twice in error handling
Date: Mon, 17 May 2010 08:45:34 -0700 [thread overview]
Message-ID: <1274111134.21875.4909.camel@nimitz> (raw)
In-Reply-To: <1274074963.25630.2.camel@mola>
On Mon, 2010-05-17 at 13:42 +0800, Axel Lin wrote:
> In current implementation, if device_create_file failed in
> register_nasgpio_led,
> led_classdev_unregister will be executed twice.
> ( in register_nasgpio_led it calls led_classdev_unregister before
> return and in nas_gpio_init out_err )
>
> This patch fixes it by only unregistering those that were successfully
> registered in out_err.
> ( not including last failed register_nasgpio_led call )
Did you actually run into this, or did you find this just auditing code?
> diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c
> index 51477ec..a688293 100644
> --- a/drivers/leds/leds-ss4200.c
> +++ b/drivers/leds/leds-ss4200.c
> @@ -534,7 +534,7 @@ static int __init nas_gpio_init(void)
> set_power_light_amber_noblink();
> return 0;
> out_err:
> - for (; i >= 0; i--)
> + for (i--; i >= 0; i--)
> unregister_nasgpio_led(i);
> pci_unregister_driver(&nas_gpio_pci_driver);
> return ret;
That i-- took me a minute to grok, but there isn't something immensely
better here. If you have to resubmit these somehow, please add a
comment there. But, otherwise,
Acked-by: Dave Hansen <dave@sr71.net>
-- Dave
prev parent reply other threads:[~2010-05-17 15:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-17 5:42 [PATCH] leds-ss4200: fix led_classdev_unregister twice in error handling Axel Lin
2010-05-17 15:45 ` Dave Hansen [this message]
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=1274111134.21875.4909.camel@nimitz \
--to=dave@sr71.net \
--cc=axel.lin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rgirod@confocus.com \
--cc=rpurdie@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.