public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds-ss4200: fix led_classdev_unregister twice in error handling
@ 2010-05-17  5:42 Axel Lin
  2010-05-17 15:45 ` Dave Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-05-17  5:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rodney Girod, Dave Hansen, Richard Purdie

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 )

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/leds/leds-ss4200.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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;
-- 
1.5.4.3




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-17 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox