]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mtd: rawnand: atmel: Defer probe if SRAM is missing
authorRob Herring (Arm) <robh@kernel.org>
Mon, 5 Jan 2026 21:06:43 +0000 (15:06 -0600)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 19 Jan 2026 10:20:42 +0000 (11:20 +0100)
The Atmel NAND controller driver depends on an SRAM pool and has an
implicit assumption that the SRAM pool has already been created.
Changing the initcall ordering can break this. Unfortunately, fw_devlink
can't save us here as there's not a standard property to track the
dependency. So it's up to deferring probe to save us.

Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/atmel/nand-controller.c

index 83ba4ebd02d41ac1b4b34b057a808b5bdb7cf0ea..e7fdf532c5fef9d0283417b82c6eb54d105817f6 100644 (file)
@@ -2304,10 +2304,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
 
        nc->sram.pool = of_gen_pool_get(nc->base.dev->of_node,
                                         "atmel,nfc-sram", 0);
-       if (!nc->sram.pool) {
-               dev_err(nc->base.dev, "Missing SRAM\n");
-               return -ENOMEM;
-       }
+       if (!nc->sram.pool)
+               return dev_err_probe(nc->base.dev, -EPROBE_DEFER, "Missing SRAM\n");
 
        nc->sram.virt = (void __iomem *)gen_pool_dma_alloc(nc->sram.pool,
                                                           ATMEL_NFC_SRAM_SIZE,