Re: [PATCH 1/2] leds-tca6507: allow driver to compile when GPIOLIBis not available.

From: NeilBrown
Date: Tue Dec 20 2011 - 16:03:59 EST


On Tue, 20 Dec 2011 12:26:51 -0800 Randy Dunlap <rdunlap@xxxxxxxxxxxx> wrote:

> On 12/20/2011 12:16 PM, Randy Dunlap wrote:
> > On 12/19/2011 09:44 PM, NeilBrown wrote:
> >> This driver can configure the outputs as GPIO line instead of LEDs. But
> >> that only works if GPIOLIB is available. So make that code conditional
> >> on the library's availability.
> >>
> >> Also remove the 'teardown' callback as it is never called and should
> >> never be needed.
> >>
> >> Signed-off-by: NeilBrown <neilb@xxxxxxx>
> >
> > Thanks. This builds.
> >
> > Acked-by: Randy Dunlap <rdunlap@xxxxxxxxxxxx>
>
> Neil,
> You might want to check this also:
>
> drivers/leds/leds-tca6507.c:358:17: warning: array subscript is above array bounds
> drivers/leds/leds-tca6507.c:357:17: warning: array subscript is above array bounds
>
>

Argh..

diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index 75dc5e4..ce20ab7 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -349,7 +349,7 @@ static int led_prepare(struct tca6507_led *led)
return 0;
}

- for (i = MASTER; i >= BANK0; i++) {
+ for (i = MASTER; i >= BANK0; i--) {
int d;
if (tca->bank[i].level == level ||
tca->bank[i].level_use == 0) {

That loop used to go up..

I might just go an re-review all the code. And repeat the tests.

Thanks a lot.

NeilBrown

Attachment: signature.asc
Description: PGP signature