From: Andrew Goodbody Date: Tue, 7 Oct 2025 11:42:12 +0000 (+0100) Subject: ufs: ti-j721e: Correct error detection X-Git-Tag: v2026.01-rc2~56^2~15 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6defecd943e92e4341cfa088ef4f4cc19ff2db8b;p=pandora-u-boot.git ufs: ti-j721e: Correct error detection In ti_j721e_ufs_probe there is a call to clk_get_rate but the code after that attempts to detect an error from that call incorrectly uses IS_ERR_VALUE. Instead the test should just be for regular error codes. The call returns an unsigned long so that needs to be cast to a signed type first of all. This issue was found by Smatch. Signed-off-by: Andrew Goodbody Reviewed-by: Anshul Dalal Link: https://patch.msgid.link/20251007-ufs_ti-v2-1-501f575b6947@linaro.org Signed-off-by: Neil Armstrong --- diff --git a/drivers/ufs/ti-j721e-ufs.c b/drivers/ufs/ti-j721e-ufs.c index c5c08610ffd..176d9b0e5c3 100644 --- a/drivers/ufs/ti-j721e-ufs.c +++ b/drivers/ufs/ti-j721e-ufs.c @@ -17,7 +17,7 @@ static int ti_j721e_ufs_probe(struct udevice *dev) { void __iomem *base; - unsigned int clock; + unsigned long clock; struct clk clk; u32 reg = 0; int ret; @@ -29,9 +29,9 @@ static int ti_j721e_ufs_probe(struct udevice *dev) } clock = clk_get_rate(&clk); - if (IS_ERR_VALUE(clock)) { + if ((long)clock <= 0) { dev_err(dev, "failed to get rate\n"); - return ret; + return clock ? clock : -EIO; } base = dev_remap_addr_index(dev, 0);