[PATCH v2 2/2] nvmem: core: stop deferring for a cell after the deferred probe timeout
From: Manikandan Muralidharan
Date: Mon Nov 30 2026 - 02:45:28 EST
nvmem_cell_get() returns -EPROBE_DEFER for as long as the nvmem device
providing a DT cell is not registered. When that device never shows up,
for instance because the flash holding the cell is not populated on the
board, the consumer is deferred forever instead of falling back to
another source.
Once the deferred probe timeout has expired, as reported by
driver_deferred_probe_check_state(), return -ENOENT instead, so that the
consumer treats the cell as missing. A provider that is merely late is
still waited for until then.
Signed-off-by: Manikandan Muralidharan <manikandan.m@xxxxxxxxxxxxx>
---
drivers/nvmem/core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index a755cc4318dc..a1208663b50e 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -1508,6 +1508,15 @@ struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id)
if (dev->of_node) { /* try dt first */
cell = of_nvmem_cell_get(dev->of_node, id);
+ /*
+ * Don't wait forever for a provider that never shows up, e.g.
+ * when the device holding it is not populated. Once the
+ * deferred probe timeout has expired, report the cell as
+ * missing so that the consumer can fall back.
+ */
+ if (PTR_ERR(cell) == -EPROBE_DEFER &&
+ driver_deferred_probe_check_state(dev) != -EPROBE_DEFER)
+ return ERR_PTR(-ENOENT);
if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER)
return cell;
}
--
2.43.0