]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: rawnand: stm32_fmc2: Ensure to return error code
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Fri, 1 Aug 2025 10:39:14 +0000 (11:39 +0100)
committerMichael Trimarchi <michael@amarulasolutions.com>
Sun, 3 Aug 2025 08:20:16 +0000 (10:20 +0200)
In stm32_fmc2_nfc_probe there are 3 error returns that do not set the
error code before returning which could lead to the error being silently
ignored. Just return -EINVAL in each case.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
drivers/mtd/nand/raw/stm32_fmc2_nand.c

index 083ea4c5a74b782ba655e1b9eac87823be9cce4e..d1c88643c98c5fe375cd69ca392d7f727303e44d 100644 (file)
@@ -942,21 +942,21 @@ static int stm32_fmc2_nfc_probe(struct udevice *dev)
                addr = dev_read_addr_index(dev, mem_region);
                if (addr == FDT_ADDR_T_NONE) {
                        dev_err(dev, "Resource data_base not found for cs%d", chip_cs);
-                       return ret;
+                       return -EINVAL;
                }
                nfc->data_base[chip_cs] = addr;
 
                addr = dev_read_addr_index(dev, mem_region + 1);
                if (addr == FDT_ADDR_T_NONE) {
                        dev_err(dev, "Resource cmd_base not found for cs%d", chip_cs);
-                       return ret;
+                       return -EINVAL;
                }
                nfc->cmd_base[chip_cs] = addr;
 
                addr = dev_read_addr_index(dev, mem_region + 2);
                if (addr == FDT_ADDR_T_NONE) {
                        dev_err(dev, "Resource addr_base not found for cs%d", chip_cs);
-                       return ret;
+                       return -EINVAL;
                }
                nfc->addr_base[chip_cs] = addr;
        }