提交 1e653acc 编写于 作者: A Axel Lin 提交者: Richard Purdie

leds: leds-ss4200: fix led_classdev_unregister twice in error handling

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: NAxel Lin <axel.lin@gmail.com>
Acked-by: NDave Hansen <dave@sr71.net>
Signed-off-by: NRichard Purdie <rpurdie@linux.intel.com>
上级 7e1ce34f
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册