linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH 2/3] ndctl, update: fix uninitialized variable warnings
Date: Wed, 21 Feb 2018 16:02:51 -0700	[thread overview]
Message-ID: <20180221230252.16632-3-vishal.l.verma@intel.com> (raw)
In-Reply-To: <20180221230252.16632-1-vishal.l.verma@intel.com>

In send_firmware, if the file size ('remain') were to be zero, 'rc'
would never get assigned. While this conditon would never be reached
because we have already checked the file size to be greater than zero,
initialize 'rc' anyway to silence the compiler warning.

Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/update.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ndctl/update.c b/ndctl/update.c
index 877d37f..71d95eb 100644
--- a/ndctl/update.c
+++ b/ndctl/update.c
@@ -208,7 +208,7 @@ static int send_firmware(struct update_context *uctx)
 {
 	struct ndctl_cmd *cmd = NULL;
 	ssize_t read;
-	int rc;
+	int rc = -ENXIO;
 	enum ND_FW_STATUS status;
 	struct fw_info *fw = &uctx->dimm_fw;
 	uint32_t copied = 0, len, remain;
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  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 ` Vishal Verma [this message]
2018-02-21 23:02 ` [ndctl PATCH 3/3] ndctl, update: remove the check for !cmd when dereferencing it Vishal Verma
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-3-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).