diff mbox

[ndctl,1/4] ndctl: fix module association for dimm objects

Message ID 20150630003134.7510.65651.stgit@dwillia2-desk3.jf.intel.com (mailing list archive)
State Accepted
Commit f979b57f731f
Headers show

Commit Message

Dan Williams June 30, 2015, 12:31 a.m. UTC
Commit e424ebceb1a8 "ndctl: trigger the kernel to re-read labels after
zeroing" didn't correctly establish the association between dimms and
their modules.  It mostly does not matter because presently all dimm
devices use the generic driver from the core, but this may change in the
future.

Acked-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 lib/libndctl.c |    3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/lib/libndctl.c b/lib/libndctl.c
index b45fd56a0e7b..0cdc3c798ad0 100644
--- a/lib/libndctl.c
+++ b/lib/libndctl.c
@@ -1113,6 +1113,9 @@  static int add_dimm(void *parent, int id, const char *dimm_base)
 	if (!dimm->dimm_path)
 		goto err_read;
 
+	sprintf(path, "%s/modalias", dimm_base);
+	if (sysfs_read_attr(ctx, path, buf) < 0)
+		goto err_read;
 	dimm->module = to_module(ctx, buf);
 
 	dimm->handle = -1;