Skip to content

Commit

Permalink
leds: Simplify logic in leds-ams-delta
Browse files Browse the repository at this point in the history
Simplify logic in leds-ams-delta after various new drivers
writers misunderstood it.

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
  • Loading branch information
Richard Purdie committed Oct 20, 2008
1 parent 270c395 commit fbf0bae
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/leds/leds-ams-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,27 @@ static int ams_delta_led_resume(struct platform_device *dev)

static int ams_delta_led_probe(struct platform_device *pdev)
{
int i;
int ret;
int i, 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,
&ams_delta_leds[i].cdev);
if (ret < 0)
goto fail;
}

if (ret < 0 && i > 1) {
for (i = i - 2; i >= 0; i--)
led_classdev_unregister(&ams_delta_leds[i].cdev);
}

return ret;
return 0;
fail:
while (--i >= 0)
led_classdev_unregister(&ams_delta_leds[i].cdev);
return ret;
}

static int ams_delta_led_remove(struct platform_device *pdev)
{
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);

return 0;
Expand Down

0 comments on commit fbf0bae

Please sign in to comment.