leds: leds-pwm: Simplify cleanup code
Peter Ujfalusi [Fri, 21 Dec 2012 09:44:00 +0000 (01:44 -0800)]
The code looks more nicer if we use:

while (i--)

instead:
if (i > 0)
for (i = i - 1; i >= 0; i--)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>

drivers/leds/leds-pwm.c

index c767837..46f4e44 100644 (file)
@@ -104,10 +104,8 @@ static int led_pwm_probe(struct platform_device *pdev)
        return 0;
 
 err:
-       if (i > 0) {
-               for (i = i - 1; i >= 0; i--)
-                       led_classdev_unregister(&priv->leds[i].cdev);
-       }
+       while (i--)
+               led_classdev_unregister(&priv->leds[i].cdev);
 
        return ret;
 }