summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-03-23 11:40:49 +0100
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2017-03-23 20:23:57 +0100
commitac572452156963588b285049ba3895bef0f17642 (patch)
treea0ab376253436ceb24dfd188a0c87c09303fbc54 /drivers/leds
parentdt-bindings: leds: Add document bindings for leds-mt6323 (diff)
downloadlinux-ac572452156963588b285049ba3895bef0f17642.tar.xz
linux-ac572452156963588b285049ba3895bef0f17642.zip
leds: mt6323: Fix an off by one bug in probe
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> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-mt6323.c2
1 files changed, 1 insertions, 1 deletions
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;