The dimm commands return zero when some operations succeed, return the
count separately from the error code.

    Before:
    # ndctl zero-labels all
    zeroed 0 nmem

    After:
    # ndctl zero-labels all
    zeroed 6 nmems

Signed-off-by: Dan Williams <[email protected]>
---
 ndctl/dimm.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ndctl/dimm.c b/ndctl/dimm.c
index b20a84911489..4d25417fb2ae 100644
--- a/ndctl/dimm.c
+++ b/ndctl/dimm.c
@@ -952,9 +952,9 @@ static int dimm_action(int argc, const char **argv, void 
*ctx,
         * count if some actions succeeded, 0 if none were attempted,
         * negative error code otherwise.
         */
-       if (rc < 0)
-               return rc;
-       return count;
+       if (count > 0)
+               return count;
+       return rc;
 }
 
 int cmd_write_labels(int argc, const char **argv, void *ctx)

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

Reply via email to