Hi Andrew, On Mon Oct 6, 2025 at 9:01 PM IST, Andrew Goodbody wrote: > 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 <[email protected]> > --- > drivers/ufs/ti-j721e-ufs.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/ufs/ti-j721e-ufs.c b/drivers/ufs/ti-j721e-ufs.c > index > c5c08610ffd0422c9cf9d8e85b0396e6102cb29a..d50918912b2168db4e00c3cac0a9c54872a76602 > 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) {
Should we be checking for clock == 0 as well? Because clk_get_rate does return 0 on invalid clock. Regards, Anshul > dev_err(dev, "failed to get rate\n"); > - return ret; > + return clock; > } > > base = dev_remap_addr_index(dev, 0); > > --- > base-commit: 7807ed921314cd7af83fd88162d0b8c6fb20a9ca > change-id: 20250813-ufs_ti-dd699eb6524e > > Best regards,

