diff mbox

[ndctl,5/6] ndctl, dimm: fix count display in the presence of errors

Message ID 149074285782.18735.18215464978773558065.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit a81bcf76be00
Headers show

Commit Message

Dan Williams March 28, 2017, 11:14 p.m. UTC
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 <dan.j.williams@intel.com>
---
 ndctl/dimm.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

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)