aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-01-10 18:09:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 19:30:49 -0500
commit3b080945aa7670354364c8f9e1a3a07cbb97beb3 (patch)
treec901525cf47e02e4423800d13bc7802755e566cd /drivers
parenta6d511e5155406cd214d3af3ff9cffc69548b006 (diff)
drivers/leds/leds-mc13783.c: fix off-by-one for checking num_leds
The LED id begins from 0. Thus the maximum number of leds should be MC13783_LED_MAX + 1. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Philippe Retornaz <philippe.retornaz@epfl.ch> Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/leds/leds-mc13783.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
index c61e8c4f5469..8bc491541550 100644
--- a/drivers/leds/leds-mc13783.c
+++ b/drivers/leds/leds-mc13783.c
@@ -275,7 +275,7 @@ static int __devinit mc13783_led_probe(struct platform_device *pdev)
275 return -ENODEV; 275 return -ENODEV;
276 } 276 }
277 277
278 if (pdata->num_leds < 1 || pdata->num_leds > MC13783_LED_MAX) { 278 if (pdata->num_leds < 1 || pdata->num_leds > (MC13783_LED_MAX + 1)) {
279 dev_err(&pdev->dev, "Invalid led count %d\n", pdata->num_leds); 279 dev_err(&pdev->dev, "Invalid led count %d\n", pdata->num_leds);
280 return -EINVAL; 280 return -EINVAL;
281 } 281 }