diff mbox series

[ndctl,v2,2/4] ndctl/libndctl: Add bus_prefix for CXL

Message ID 167105523165.3034751.4940603908511673299.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State Accepted
Commit 61c7e3049176d26c37f5f4282b45aceb3b565f09
Headers show
Series ndctl: Add security test for cxl devices through nvdimm | expand

Commit Message

Dave Jiang Dec. 14, 2022, 10 p.m. UTC
When the 'ndbus' is backed by CXL, setup the bus_prefix for dimm object
appropriately.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>

---
v2:
- improve commit log. (Vishal)
---
 ndctl/lib/libndctl.c |    6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 10422e24d38b..d2e800bc840a 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -2012,6 +2012,12 @@  static void *add_dimm(void *parent, int id, const char *dimm_base)
 			goto out;
 		}
 		rc =  add_papr_dimm(dimm, dimm_base);
+	} else if (ndctl_bus_has_cxl(bus)) {
+		dimm->bus_prefix = strdup("cxl");
+		if (!dimm->bus_prefix) {
+			rc = -ENOMEM;
+			goto out;
+		}
 	}
 
 	if (rc == -ENODEV) {