public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: mt6323: Fix an off by one bug in probe
@ 2017-03-23 10:40 Dan Carpenter
  2017-03-23 11:16 ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-03-23 10:40 UTC (permalink / raw)
  To: Richard Purdie, Sean Wang
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jacek Anaszewski,
	Pavel Machek, Matthias Brugger, linux-leds-u79uwXL29TY76Z2rM5mHXA

It should be ">= MT6323_MAX_LEDS" instead of ">".  Also "reg" is a u32
so it can't be negative and we can remove the test for negative values.

Fixes: 216ec6cc4c19 ("leds: Add LED support for MT6323 PMIC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c
index 48081bccbea5..8893c74e9a1f 100644
--- a/drivers/leds/leds-mt6323.c
+++ b/drivers/leds/leds-mt6323.c
@@ -417,7 +417,7 @@ static int mt6323_led_probe(struct platform_device *pdev)
 			goto put_child_node;
 		}
 
-		if (reg < 0 || reg > MT6323_MAX_LEDS || leds->led[reg]) {
+		if (reg >= MT6323_MAX_LEDS || leds->led[reg]) {
 			dev_err(dev, "Invalid led reg %u\n", reg);
 			ret = -EINVAL;
 			goto put_child_node;

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

end of thread, other threads:[~2017-03-23 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-23 10:40 [PATCH] leds: mt6323: Fix an off by one bug in probe Dan Carpenter
2017-03-23 11:16 ` Pavel Machek
2017-03-23 19:37   ` Jacek Anaszewski

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