[PATCH] i2c: rcar_iic: Do not use unitialised variable

Andrew Goodbody andrew.goodbody at linaro.org
Mon Jul 28 17:04:43 CEST 2025


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 <andrew.goodbody at linaro.org>
---
 drivers/i2c/rcar_iic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/rcar_iic.c b/drivers/i2c/rcar_iic.c
index e019d06be41..42d575e29ba 100644
--- a/drivers/i2c/rcar_iic.c
+++ b/drivers/i2c/rcar_iic.c
@@ -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,
-- 
Andrew Goodbody <andrew.goodbody at linaro.org>



More information about the U-Boot mailing list