From: Diego Dompe <[email protected]>

Currently when using ndctl in machines that do not have numa, the ndctl
command fails because it fails to find the numa_node attribute in
systems.

Just assume the default, zero, in these cases rather than fail.

Link: https://github.com/pmem/ndctl/pull/9
[djbw: minor style fixups]
Signed-off-by: Dan Williams <[email protected]>
---

Diego, if this reworked version looks good to you I'll add your
"Signed-off-by: Diego Dompe <[email protected]>" to the tags. Let me know.
Thanks for the fix!

 ndctl/lib/libndctl.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index ea3111eb6c93..8240235dff5c 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -2780,9 +2780,8 @@ static void *add_namespace(void *parent, int id, const 
char *ndns_base)
        ndns->raw_mode = strtoul(buf, NULL, 0);
 
        sprintf(path, "%s/numa_node", ndns_base);
-       if (sysfs_read_attr(ctx, path, buf) < 0)
-               goto err_read;
-       ndns->numa_node = strtol(buf, NULL, 0);
+       if (sysfs_read_attr(ctx, path, buf) == 0)
+               ndns->numa_node = strtol(buf, NULL, 0);
 
        switch (ndns->type) {
        case ND_DEVICE_NAMESPACE_BLK:

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to