diff mbox

[ndctl,3/7] ndctl: fix some warnings

Message ID 146161380523.21779.1858997961702829201.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit a17c2e322011
Headers show

Commit Message

Dan Williams April 25, 2016, 7:50 p.m. UTC
builtin-read-labels.c:417:5: warning: 'count' may be used uninitialized in this function
builtin-xaction-namespace.c:526:2: warning: 'buf' may be used uninitialized in this function

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 builtin-read-labels.c       |    3 +--
 builtin-xaction-namespace.c |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/builtin-read-labels.c b/builtin-read-labels.c
index bea20184c7f8..9dd90c92304e 100644
--- a/builtin-read-labels.c
+++ b/builtin-read-labels.c
@@ -336,7 +336,7 @@  int cmd_read_labels(int argc, const char **argv)
 	struct ndctl_dimm *dimm;
 	struct ndctl_ctx *ctx;
 	struct ndctl_bus *bus;
-	int i, rc, count, err = 0;
+	int i, rc, count = 0, err = 0;
 	FILE *f_out = NULL;
 
         argc = parse_options(argc, argv, nmem_options, u, 0);
@@ -377,7 +377,6 @@  int cmd_read_labels(int argc, const char **argv)
 	if (rc < 0)
 		goto out;
 
-	count = 0;
         ndctl_bus_foreach(ctx, bus) {
 		if (!util_bus_filter(bus, nmem_bus))
 			continue;
diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c
index 40f62822facd..d20e9167dc81 100644
--- a/builtin-xaction-namespace.c
+++ b/builtin-xaction-namespace.c
@@ -490,8 +490,8 @@  static int zero_info_block(struct ndctl_namespace *ndns)
 {
 	const char *devname = ndctl_namespace_get_devname(ndns);
 	int fd, rc = -ENXIO;
+	void *buf = NULL;
 	char path[50];
-	void *buf;
 
 	ndctl_namespace_set_raw_mode(ndns, 1);
 	rc = ndctl_namespace_enable(ndns);