Skip to content

Commit

Permalink
leds: leds-pwm: Simplify cleanup code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Ujfalusi authored and Bryan Wu committed Feb 2, 2013
1 parent 261a5ed commit 8a66a57
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/leds/leds-pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8a66a57

Please sign in to comment.