diff mbox series

[ndctl,v2,15/26] ndctl/dimm: Fix init-labels success reporting

Message ID 156426364243.531577.13465180915476535003.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Superseded
Headers show
Series Improvements for namespace creation/interrogation | expand

Commit Message

Dan Williams July 27, 2019, 9:40 p.m. UTC
When a DIMM is disabled due to a label parsing issue "ndctl init-labels"
mis-reports the status of the init-labels command:

    # ndctl init-labels all -f
    initialized 1 nmem
    [root@dwillia2-dev ndctl]# ndctl list -Di
    [
      {
        "dev":"nmem1",
        "id":"8680-57341200",
        "handle":2,
        "phys_id":0,
        "state":"disabled"
      },
      {
        "dev":"nmem0",
        "id":"8680-56341200",
        "handle":1,
        "phys_id":0
      }
    ]
    # ndctl init-labels nmem1 -f
    initialized 1020 nmems

Catch any positive return from action_init() as success:

    # ndctl init-labels all -f
    initialized 2 nmems
    # ndctl init-labels nmem1 -f
    initialized 1 nmem

Reported-by: Jane Chu <jane.chu@oracle.com>

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/dimm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ndctl/dimm.c b/ndctl/dimm.c
index c7ad621367e9..5e6fa19bab15 100644
--- a/ndctl/dimm.c
+++ b/ndctl/dimm.c
@@ -1035,7 +1035,7 @@  static int __action_init(struct ndctl_dimm *dimm,
 
  out:
 	ndctl_cmd_unref(cmd_read);
-	return rc;
+	return rc >= 0 ? 0 : rc;
 }
 
 static int action_init(struct ndctl_dimm *dimm, struct action_context *actx)