Skip to content

Commit

Permalink
leds: mt6323: Fix an off by one bug in probe
Browse files Browse the repository at this point in the history
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: 216ec6c ("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>
  • Loading branch information
Dan Carpenter authored and Jacek Anaszewski committed Mar 23, 2017
1 parent 6234004 commit ac57245
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/leds/leds-mt6323.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ac57245

Please sign in to comment.