[PATCH] serial: lpuart: Return value from correct variable

Andrew Goodbody andrew.goodbody at linaro.org
Mon Aug 11 18:25:17 CEST 2025


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

diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 93602797b83..9fdb6503085 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -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;

---
base-commit: 83ce0b483c1680cb39565a9d91c6ef113a309c38
change-id: 20250811-serial_lpuart-aff78c0f3799

Best regards,
-- 
Andrew Goodbody <andrew.goodbody at linaro.org>



More information about the U-Boot mailing list