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 <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
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;