ndctl_cmd_unref() already checks for the cmd being NULL, no need to
check at every call site.
Cc: Dave Jiang <dave.jiang(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
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