]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: nand: raw: omap_gpmc: Check return value of gpmc_nand_init
authorVignesh Raghavendra <vigneshr@ti.com>
Wed, 31 Jul 2024 14:58:55 +0000 (20:28 +0530)
committerTom Rini <trini@konsulko.com>
Tue, 27 Aug 2024 20:27:44 +0000 (14:27 -0600)
If the function is called with no NAND device attached, then this
function can return error value, proceeding further ignoring the same
can cause system crash. This is seen when "mtd list" is run with no NAND
addon cards connected.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Acked-by: Roger Quadros <rogerq@kernel.org>
drivers/mtd/nand/raw/omap_gpmc.c

index 92a92ad63a022223b7c262d03f1e78a297520ada..a36e2a148ccceda1d63d898d5423a9c0737d6d59 100644 (file)
@@ -1188,7 +1188,10 @@ static int gpmc_nand_probe(struct udevice *dev)
                return ret;
 
        base = devm_ioremap(dev, res.start, resource_size(&res));
-       gpmc_nand_init(nand, base);
+       ret = gpmc_nand_init(nand, base);
+       if (ret)
+               return ret;
+
        mtd->dev = dev;
        nand_set_flash_node(nand, dev_ofnode(dev));