Re: [PATCH -mm 2/2] PWM LED driver

From: Haavard Skinnemoen
Date: Mon Jan 28 2008 - 04:16:18 EST


On Sun, 27 Jan 2008 21:32:32 -0800
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Thu, 24 Jan 2008 15:33:45 +0100 Haavard Skinnemoen <hskinnemoen@xxxxxxxxx> wrote:
>
> > + if (i > 0) {
> > + for (i = i - 1; i >= 0; i--) {
> > + led_classdev_unregister(&leds[i].cdev);
> > + pwm_channel_free(&leds[i].pwmc);
> > + }
> > + }
>
> Could be:
>
> while (--i > 0) {
> led_classdev_unregister(&leds[i].cdev);
> pwm_channel_free(&leds[i].pwmc);
> }
>
> or thereabouts.

Almost...we need to clean up for leds[0] too. Using a postfix decrement
should take care of that. How about the patch below?

Haavard