diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2008-10-20 18:46:15 -0400 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2008-10-20 18:47:50 -0400 |
commit | fbf0baee84cd31d3a800010139fcd01b8b11cbf9 (patch) | |
tree | 0c414bbce02864326832dd29a247134011324399 /drivers/leds | |
parent | 270c3957dbc5bedf093dc864840be0cc6dbda1f6 (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.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/leds/leds-ams-delta.c b/drivers/leds/leds-ams-delta.c index 32c98b2efa3f..1bd590bb3a6e 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) | |||
107 | 107 | ||
108 | static int ams_delta_led_probe(struct platform_device *pdev) | 108 | static int ams_delta_led_probe(struct platform_device *pdev) |
109 | { | 109 | { |
110 | int i; | 110 | int i, ret; |
111 | int ret; | ||
112 | 111 | ||
113 | for (i = ret = 0; ret >= 0 && i < ARRAY_SIZE(ams_delta_leds); i++) { | 112 | for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) { |
114 | ret = led_classdev_register(&pdev->dev, | 113 | ret = led_classdev_register(&pdev->dev, |
115 | &ams_delta_leds[i].cdev); | 114 | &ams_delta_leds[i].cdev); |
115 | if (ret < 0) | ||
116 | goto fail; | ||
116 | } | 117 | } |
117 | 118 | ||
118 | if (ret < 0 && i > 1) { | 119 | return 0; |
119 | for (i = i - 2; i >= 0; i--) | 120 | fail: |
120 | led_classdev_unregister(&ams_delta_leds[i].cdev); | 121 | while (--i >= 0) |
121 | } | 122 | led_classdev_unregister(&ams_delta_leds[i].cdev); |
122 | 123 | return ret; | |
123 | return ret; | ||
124 | } | 124 | } |
125 | 125 | ||
126 | static int ams_delta_led_remove(struct platform_device *pdev) | 126 | static int ams_delta_led_remove(struct platform_device *pdev) |
127 | { | 127 | { |
128 | int i; | 128 | int i; |
129 | 129 | ||
130 | for (i = ARRAY_SIZE(ams_delta_leds) - 1; i >= 0; i--) | 130 | for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i--) |
131 | led_classdev_unregister(&ams_delta_leds[i].cdev); | 131 | led_classdev_unregister(&ams_delta_leds[i].cdev); |
132 | 132 | ||
133 | return 0; | 133 | return 0; |