提交 ac572452 编写于 作者: D Dan Carpenter 提交者: Jacek Anaszewski

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: 216ec6cc ("leds: Add LED support for MT6323 PMIC")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NPavel Machek <pavel@ucw.cz>
Signed-off-by: NJacek Anaszewski <jacek.anaszewski@gmail.com>
上级 6234004c
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册