diff mbox series

[leds] leds: tca6507: fix potential zero passed to ERR_PTR

Message ID 20200926194302.22003-1-kabel@kernel.org
State New
Headers show
Series [leds] leds: tca6507: fix potential zero passed to ERR_PTR | expand

Commit Message

Marek BehĂșn Sept. 26, 2020, 7:43 p.m. UTC
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>
---
 drivers/leds/leds-tca6507.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavel Machek Sept. 26, 2020, 7:54 p.m. UTC | #1
Hi!

> Fix potential ERR_PTR(0).


Thanks, applied, and reorganized patches so that fix goes near the bad
commit.

Best regards,
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
diff mbox series

Patch

diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index 4b10ef9ae221..d589c89930fd 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -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;