ndctl_cmd_unref() already checks for the cmd being NULL, no need to
check at every call site.

Cc: Dave Jiang <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
---
 ndctl/update.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/ndctl/update.c b/ndctl/update.c
index 71d95eb..4ca6a0d 100644
--- a/ndctl/update.c
+++ b/ndctl/update.c
@@ -254,8 +254,7 @@ static int send_firmware(struct update_context *uctx)
        }
 
 cleanup:
-       if (cmd)
-               ndctl_cmd_unref(cmd);
+       ndctl_cmd_unref(cmd);
        free(buf);
        return rc;
 }
@@ -546,8 +545,7 @@ int cmd_update_firmware(int argc, const char **argv, void 
*ctx)
        if (rc < 0)
                return rc;
 
-       if (uctx.start)
-               ndctl_cmd_unref(uctx.start);
+       ndctl_cmd_unref(uctx.start);
 
        return 0;
 }
-- 
2.14.3

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

Reply via email to