[PATCH v1] cxl/pmem: Defer nvdimm bridge attachment failures

From: Li Chen

Date: Wed Mar 25 2026 - 02:23:54 EST


cxl_acpi is initialized before cxl_pmem registers
cxl_nvdimm_bridge_driver when both are built in.
__devm_cxl_add_nvdimm_bridge() creates the nvdimm bridge
device and immediately checks whether a driver bound to it.
At that point the device may already exist while the bridge
driver is not registered, or has not bound yet, so

dev->driver == NULL

is only a temporary state rather than a permanent -ENODEV
failure.

Treating that state as fatal makes cxl_acpi probe fail, so
the root CXL topology never becomes visible to userspace and
region creation later reports no active memdevs.

Return -EPROBE_DEFER instead so cxl_acpi retries after
cxl_nvdimm_bridge_driver is registered.

Signed-off-by: Li Chen <me@linux.beauty>
---
drivers/cxl/core/pmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/core/pmem.c b/drivers/cxl/core/pmem.c
index 68462e38a977..a213eb074814 100644
--- a/drivers/cxl/core/pmem.c
+++ b/drivers/cxl/core/pmem.c
@@ -149,7 +149,7 @@ struct cxl_nvdimm_bridge *__devm_cxl_add_nvdimm_bridge(struct device *host,

if (cxl_nvdimm_bridge_failed_attach(cxl_nvb)) {
unregister_nvb(cxl_nvb);
- return ERR_PTR(-ENODEV);
+ return ERR_PTR(-EPROBE_DEFER);
}

rc = devm_add_action_or_reset(host, unregister_nvb, cxl_nvb);
--
2.52.0