Skip to content

Commit

Permalink
leds: tca6507: fix potential zero passed to ERR_PTR
Browse files Browse the repository at this point in the history
Fix potential ERR_PTR(0).

Signed-off-by: Marek Behún <[email protected]>
Fixes: d78b10f5713d9 ("leds: tca6507: use fwnode API instead of OF")
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
  • Loading branch information
elkablo authored and pavelmachek committed Sep 30, 2020
1 parent e8b7dab commit a238098
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/leds/leds-tca6507.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ tca6507_led_dt_init(struct i2c_client *client)
ret = fwnode_property_read_u32(child, "reg", &reg);
if (ret || reg >= NUM_LEDS) {
fwnode_handle_put(child);
return ERR_PTR(ret);
return ERR_PTR(ret ? : -EINVAL);
}

tca_leds[reg] = led;
Expand Down

0 comments on commit a238098

Please sign in to comment.