Skip to contentSkip to conversation

mtd: nand: raw: omap_gpmc: Check return value of gpmc_nand_init

PATCH In review Vignesh Raghavendra 4 participants 4 messages Jul 31, 2024 – Aug 28, 2024

Subsystems (2)
lore
Share & tools
lore

Vignesh Raghavendra

author maintainer
#0 lore raw

PATCH 1/1 mtd: nand: raw: omap_gpmc: Check return value of gpmc_nand_init

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.

---
 drivers/mtd/nand/raw/omap_gpmc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/omap_gpmc.c +4 -1
index 92a92ad63a02..a36e2a148ccc 100644
@@ -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));
 
Signature · 1 line
2.45.2
#2 lore raw
In reply to Vignesh Raghavendra
Quoted 6 lines · Vignesh Raghavendra

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.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
#3 lore raw

Hi Tom

Quoted 10 lines · Tom Rini
Quoted 6 lines · Vignesh Raghavendra

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.

Quoted 6 lines

Applied to u-boot/next, thanks!

--
Tom

Thank you to pick it up, I did not see it

Michael

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com