aboutsummaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2008-10-20 23:46:15 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2008-10-20 23:47:50 +0100
commitfbf0baee84cd31d3a800010139fcd01b8b11cbf9 (patch)
tree0c414bbce02864326832dd29a247134011324399 /drivers/leds
parent270c3957dbc5bedf093dc864840be0cc6dbda1f6 (diff)
leds: Simplify logic in leds-ams-delta
Simplify logic in leds-ams-delta after various new drivers writers misunderstood it. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-ams-delta.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/leds/leds-ams-delta.c b/drivers/leds/leds-ams-delta.c
index 32c98b2efa3..1bd590bb3a6 100644
--- a/drivers/leds/leds-ams-delta.c
+++ b/drivers/leds/leds-ams-delta.c
@@ -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;