i2c: rcar_iic: Do not use unitialised variable
Subsystems (2)
PATCH 1/1 i2c: rcar_iic: Do not use unitialised variable
In rcar_iic_xfer if nmsgs == 0 the ret will not be assigned to. As ret will always be 0 if the for loop is entered, may as well just return 0.
This issue was found by Smatch.
Signed-off-by Andrew Goodbody <[email protected]>
--- drivers/i2c/rcar_iic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/rcar_iic.c +1 -1
@@ -191,7 +191,7 @@ static int rcar_iic_xfer(struct udevice *dev, struct i2c_msg *msg, int nmsgs)return -EREMOTEIO ; } -return ret; +return 0 ; }static int rcar_iic_set_speed (struct udevice *dev,uint speed)
---
base-commit: 4c3b5fcd810081bd7f3c51859fe1b5f0c159803c
change-id: 20250728-rcar_iic-ea0eccf7da46
Best regards,
Signature · 1 line
Andrew Goodbody <[email protected]>
Hello Andrew,
Quoted 9 lines · Andrew Goodbody
In
rcar_iic_xferif nmsgs == 0 the ret will not be assigned to. As ret will always be 0 if the for loop is entered, may as well just return 0.This issue was found by Smatch.
Signed-off-by Andrew Goodbody <[email protected]>--- drivers/i2c/rcar_iic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Heiko Schocher <[email protected]>
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Johanna Denk, Tabea Lutz HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Quoted 6 lines · Andrew Goodbody
In
rcar_iic_xferif nmsgs == 0 the ret will not be assigned to. As ret will always be 0 if the for loop is entered, may as well just return 0.This issue was found by Smatch.
Signed-off-by Andrew Goodbody <[email protected]>
Reviewed-by Marek Vasut <[email protected]>
Thanks !