From: Vishal Verma <vishal.l.verma@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH 3/3] ndctl, update: remove the check for !cmd when dereferencing it
Date: Wed, 21 Feb 2018 16:02:52 -0700 [thread overview]
Message-ID: <20180221230252.16632-4-vishal.l.verma@intel.com> (raw)
In-Reply-To: <20180221230252.16632-1-vishal.l.verma@intel.com>
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 --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
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2018-02-21 22:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 23:02 [ndctl PATCH 0/3] add -Wmaybe-uninitialized Vishal Verma
2018-02-21 23:02 ` [ndctl PATCH 1/3] ndctl, inject-smart: cleanup uninitialized variable warnings Vishal Verma
2018-02-21 23:02 ` [ndctl PATCH 2/3] ndctl, update: fix " Vishal Verma
2018-02-21 23:02 ` Vishal Verma [this message]
2018-02-21 23:06 ` [ndctl PATCH 4/3] ndctl, configure: add -Wmaybe-uninitialized to cflags Vishal Verma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180221230252.16632-4-vishal.l.verma@intel.com \
--to=vishal.l.verma@intel.com \
--cc=linux-nvdimm@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).