diff mbox

[ndctl,3/3] ndctl, update: remove the check for !cmd when dereferencing it

Message ID 20180221230252.16632-4-vishal.l.verma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Verma, Vishal L Feb. 21, 2018, 11:02 p.m. UTC
ndctl_cmd_unref() already checks for the cmd being NULL, no need to
check at every call site.

Cc: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/update.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox

Patch

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;
 }