Skip to content

Commit

Permalink
leds: leds-ss4200: fix led_classdev_unregister twice in error handling
Browse files Browse the repository at this point in the history
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>
Acked-by: Dave Hansen <dave@sr71.net>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
  • Loading branch information
Axel Lin authored and Richard Purdie committed May 26, 2010
1 parent 7e1ce34 commit 1e653ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/leds/leds-ss4200.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1e653ac

Please sign in to comment.