Skip to contentSkip to conversation

i2c: rcar_iic: Do not use unitialised variable

PATCH In review Andrew Goodbody 3 participants 3 messages Jul 28, 2025 – Aug 6, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
 drivers/i2c/rcar_iic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/rcar_iic.c +1 -1
index e019d06be41..42d575e29ba 100644
@@ -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]>
Reviewed-by on v1 1/1
#1 lore raw

Hello Andrew,

Quoted 9 lines · Andrew Goodbody

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.

---
  drivers/i2c/rcar_iic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

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]