]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
serial: lpuart: Return value from correct variable
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Mon, 11 Aug 2025 16:25:17 +0000 (17:25 +0100)
committerPeng Fan <peng.fan@nxp.com>
Wed, 27 Aug 2025 07:52:20 +0000 (15:52 +0800)
In get_lpuart_clk_rate if the call to clk_get_rate returns an error then
the call to return should pass the value of the error which is in rate
rather than ret which will be 0 as its value is not affected by this
error.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/serial/serial_lpuart.c

index 93602797b833469a2ebf4efe760369ac89e1027f..9fdb6503085d6581108cf301b106455d5c9b14f9 100644 (file)
@@ -129,7 +129,7 @@ static int get_lpuart_clk_rate(struct udevice *dev, u32 *clk_rate)
        rate = clk_get_rate(&clk);
        if ((long)rate <= 0) {
                dev_err(dev, "Failed to get clk rate: %ld\n", (long)rate);
-               return ret;
+               return rate;
        }
        *clk_rate = rate;
        return 0;