leds: tca6507: fix potential zero passed to ERR_PTR
Fix potential ERR_PTR(0). Signed-off-by: Marek Behún <kabel@kernel.org> Fixes: d78b10f5713d9 ("leds: tca6507: use fwnode API instead of OF") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
parent
e8b7dabc65
commit
a238098251
@ -727,7 +727,7 @@ tca6507_led_dt_init(struct i2c_client *client)
|
|||||||
ret = fwnode_property_read_u32(child, "reg", ®);
|
ret = fwnode_property_read_u32(child, "reg", ®);
|
||||||
if (ret || reg >= NUM_LEDS) {
|
if (ret || reg >= NUM_LEDS) {
|
||||||
fwnode_handle_put(child);
|
fwnode_handle_put(child);
|
||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret ? : -EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
tca_leds[reg] = led;
|
tca_leds[reg] = led;
|
||||||
|
Loading…
Reference in New Issue
Block a user