public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: mc13783: fix off-by-one for checking num_leds
@ 2011-12-10  7:14 Axel Lin
  2011-12-12  9:45 ` Philippe Rétornaz
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-12-10  7:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Philippe Retornaz, Richard Purdie, Andrew Morton

The LED id is begin from 0.
Thus the maximum number of leds should be MC13783_LED_MAX + 1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/leds/leds-mc13783.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
index c61e8c4..8bc4915 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;
 	}
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] leds: mc13783: fix off-by-one for checking num_leds
  2011-12-10  7:14 [PATCH] leds: mc13783: fix off-by-one for checking num_leds Axel Lin
@ 2011-12-12  9:45 ` Philippe Rétornaz
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Rétornaz @ 2011-12-12  9:45 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Richard Purdie, Andrew Morton

Le samedi 10 décembre 2011 15:14:56 Axel Lin a écrit :
> The LED id is begin from 0.
> Thus the maximum number of leds should be MC13783_LED_MAX + 1.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/leds/leds-mc13783.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
> index c61e8c4..8bc4915 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;
>  	}

Acked-by: Philippe Retornaz <philippe.retornaz@epfl.ch>

Thanks ! 

Philippe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-12  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-10  7:14 [PATCH] leds: mc13783: fix off-by-one for checking num_leds Axel Lin
2011-12-12  9:45 ` Philippe Rétornaz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox