imx93: adc: local variable ret should not be unsigned
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 22 Jul 2025 13:40:24 +0000 (14:40 +0100)
committerFabio Estevam <festevam@gmail.com>
Thu, 24 Jul 2025 11:00:08 +0000 (08:00 -0300)
Local variable ret is declared as unsigned but is used to receive the
return value of functions that return int. ret is then tested for being
negative which must always fail. Change ret to be an int.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/adc/imx93-adc.c

index f593fb6..d671df7 100644 (file)
@@ -221,7 +221,7 @@ static int imx93_adc_stop(struct udevice *dev)
 static int imx93_adc_probe(struct udevice *dev)
 {
        struct imx93_adc_priv *adc = dev_get_priv(dev);
-       unsigned int ret;
+       int ret;
 
        ret = imx93_adc_calibration(adc);
        if (ret < 0)
@@ -238,7 +238,7 @@ static int imx93_adc_of_to_plat(struct udevice *dev)
 {
        struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev);
        struct imx93_adc_priv *adc = dev_get_priv(dev);
-       unsigned int ret;
+       int ret;
 
        adc->regs = dev_read_addr_ptr(dev);
        if (adc->regs == (struct imx93_adc *)FDT_ADDR_T_NONE) {