[PATCH] PWM led driver: Simplify cleanup loop
From: Haavard Skinnemoen
Date: Mon Jan 28 2008 - 04:14:14 EST
Why use a for loop inside an if() when we can get away with a simple
while() loop?
Signed-off-by: Haavard Skinnemoen <hskinnemoen@xxxxxxxxx>
---
drivers/leds/leds-atmel-pwm.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c
index af61f55..187031c 100644
--- a/drivers/leds/leds-atmel-pwm.c
+++ b/drivers/leds/leds-atmel-pwm.c
@@ -100,11 +100,9 @@ static int __init pwmled_probe(struct platform_device *pdev)
return 0;
err:
- if (i > 0) {
- for (i = i - 1; i >= 0; i--) {
- led_classdev_unregister(&leds[i].cdev);
- pwm_channel_free(&leds[i].pwmc);
- }
+ while (i-- > 0) {
+ led_classdev_unregister(&leds[i].cdev);
+ pwm_channel_free(&leds[i].pwmc);
}
kfree(leds);
--
1.5.3.8
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/