From 3f49624bb50708020df1ad2fa531adc4d741b956 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 16 Dec 2011 15:50:15 +1100 Subject: [PATCH] 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 Acked-by: Philippe Retornaz Cc: Richard Purdie Signed-off-by: Andrew Morton --- drivers/leds/leds-mc13783.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) return -ENODEV; } - if (pdata->num_leds < 1 || pdata->num_leds > MC13783_LED_MAX) { + if (pdata->num_leds < 1 || pdata->num_leds > (MC13783_LED_MAX + 1)) { dev_err(&pdev->dev, "Invalid led count %d\n", pdata->num_leds); return -EINVAL; } -- 2.39.5