aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-ams-delta.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds/leds-ams-delta.c')
-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 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
108static int ams_delta_led_probe(struct platform_device *pdev) 108static 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--) 120fail:
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
126static int ams_delta_led_remove(struct platform_device *pdev) 126static 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;