]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
i2c: rcar_iic: Do not use unitialised variable
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Mon, 28 Jul 2025 15:04:43 +0000 (16:04 +0100)
committerMarek Vasut <marek.vasut+renesas@mailbox.org>
Wed, 6 Aug 2025 14:52:27 +0000 (16:52 +0200)
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@linaro.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
drivers/i2c/rcar_iic.c

index e019d06be4193c53cbf700c463b542cd05c8b2bd..42d575e29ba01986e11b1953fdc7ace88da59c05 100644 (file)
@@ -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)