Commit fbf0baee authored by Richard Purdie's avatar Richard Purdie

leds: Simplify logic in leds-ams-delta

Simplify logic in leds-ams-delta after various new drivers
writers misunderstood it.
Signed-off-by: default avatarRichard Purdie <rpurdie@linux.intel.com>
parent 270c3957
...@@ -107,19 +107,19 @@ static int ams_delta_led_resume(struct platform_device *dev) ...@@ -107,19 +107,19 @@ static int ams_delta_led_resume(struct platform_device *dev)
static int ams_delta_led_probe(struct platform_device *pdev) static int ams_delta_led_probe(struct platform_device *pdev)
{ {
int i; int i, ret;
int ret;
for (i = ret = 0; ret >= 0 && i < ARRAY_SIZE(ams_delta_leds); i++) { for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) {
ret = led_classdev_register(&pdev->dev, ret = led_classdev_register(&pdev->dev,
&ams_delta_leds[i].cdev); &ams_delta_leds[i].cdev);
if (ret < 0)
goto fail;
} }
if (ret < 0 && i > 1) { return 0;
for (i = i - 2; i >= 0; i--) fail:
while (--i >= 0)
led_classdev_unregister(&ams_delta_leds[i].cdev); led_classdev_unregister(&ams_delta_leds[i].cdev);
}
return ret; return ret;
} }
...@@ -127,7 +127,7 @@ static int ams_delta_led_remove(struct platform_device *pdev) ...@@ -127,7 +127,7 @@ static int ams_delta_led_remove(struct platform_device *pdev)
{ {
int i; int i;
for (i = ARRAY_SIZE(ams_delta_leds) - 1; i >= 0; i--) for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i--)
led_classdev_unregister(&ams_delta_leds[i].cdev); led_classdev_unregister(&ams_delta_leds[i].cdev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment