[PATCH V2] mtd: rawnand: brcmnand: propagate init error -EPROBE_DEFER up

Rafał Miłecki zajec5 at gmail.com
Wed Jul 19 01:43:24 PDT 2023


From: Rafał Miłecki <rafal at milecki.pl>

MTD subsystem may return -EPROBE_DEFER if something isn't ready yet.
It's important to pass that error up so device will get probed later.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
V2: Add of_node_put() - thanks Miquel!
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 39661e23d7d4..03764b589ec5 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -3245,6 +3245,10 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
 
 			ret = brcmnand_init_cs(host, NULL);
 			if (ret) {
+				if (ret == -EPROBE_DEFER) {
+					of_node_put(child);
+					goto err;
+				}
 				devm_kfree(dev, host);
 				continue; /* Try all chip-selects */
 			}
-- 
2.35.3




More information about the linux-mtd mailing list