The patch titled Subject: leds-tca6507 - fix off by one error. has been added to the -mm tree. Its filename is leds-tca6507-fix-off-by-one-error.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ From: NeilBrown <neilb@xxxxxxx> Subject: leds-tca6507 - fix off by one error. When walking the list of possible time codes we can fall off the end. Fix that, and also improved the commentary. Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: NeilBrown <neilb@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/leds/leds-tca6507.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff -puN drivers/leds/leds-tca6507.c~leds-tca6507-fix-off-by-one-error drivers/leds/leds-tca6507.c --- a/drivers/leds/leds-tca6507.c~leds-tca6507-fix-off-by-one-error +++ a/drivers/leds/leds-tca6507.c @@ -172,7 +172,8 @@ static int choose_times(int msec, int *c { /* * Choose two timecodes which add to 'msec' as near as possible. - * The first returned should be the larger. + * The first returned should be the larger and is the 'on' of 'off' + * time. The second will be used as a 'fade-on' or 'fade-off' time. * If cannot get within 1/8, fail. * If two possibilities are equally good (e.g. 512+0, 256+256), choose * the first pair so there is more change-time visible (i.e. it is @@ -183,7 +184,10 @@ static int choose_times(int msec, int *c int tmin = msec * 7 / 8; int diff = 65536; - for (c1 = 1; c1 <= TIMECODES; c1++) { + /* We start at '1' to ensure we never even think of choosing a + * total time of '0'. + */ + for (c1 = 1; c1 < TIMECODES; c1++) { int t = time_codes[c1]; if (t*2 < tmin) continue; _ Subject: Subject: leds-tca6507 - fix off by one error. Patches currently in -mm which might be from neilb@xxxxxxx are origin.patch linux-next.patch leds-add-driver-for-tca6507-led-controller.patch leds-add-driver-for-tca6507-led-controller-fix.patch leds-add-driver-for-tca6507-led-controller-checkpatch-fixes.patch leds-tca6507-allow-driver-to-compile-when-gpiolib-is-not-available.patch leds-tca6507-allow-driver-to-compile-when-gpiolib-is-not-available-fix.patch leds-tca6507-fix-off-by-one-error.patch ipc-provide-generic-compat-versions-of-ipc-syscalls.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html