diff mbox

[ndctl,2/3] ndctl: fix uninitialized variable warnings

Message ID 20150728031433.19103.56329.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 573cbf1ee2f9
Delegated to: Vishal Verma
Headers show

Commit Message

Dan Williams July 28, 2015, 3:14 a.m. UTC
Fix a couple warnings that pop when building with rpmbuild:

builtin-zero-labels.c: In function 'cmd_zero_labels':
builtin-zero-labels.c:50:20: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
lib/libndctl.c: In function 'ndctl_bind':
lib/libndctl.c:3073:5: warning: 'rc' may be used uninitialized in this function [-Wmaybe-unini

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 builtin-zero-labels.c |    2 +-
 lib/libndctl.c        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/builtin-zero-labels.c b/builtin-zero-labels.c
index 0b786d137817..ae2bb3a8fdb0 100644
--- a/builtin-zero-labels.c
+++ b/builtin-zero-labels.c
@@ -47,7 +47,7 @@  int cmd_zero_labels(int argc, const char **argv)
 	struct ndctl_dimm *dimm;
 	struct ndctl_ctx *ctx;
 	struct ndctl_bus *bus;
-	int i, rc, count, err;
+	int i, rc, count, err = 0;
 
         argc = parse_options(argc, argv, nmem_options, u, 0);
 
diff --git a/lib/libndctl.c b/lib/libndctl.c
index b87c7cf2a7cf..6139af363b48 100644
--- a/lib/libndctl.c
+++ b/lib/libndctl.c
@@ -3019,8 +3019,8 @@  NDCTL_EXPORT int ndctl_namespace_is_enabled(struct ndctl_namespace *ndns)
 static int ndctl_bind(struct ndctl_ctx *ctx, struct kmod_module *module,
 		const char *devname)
 {
-	int rc;
 	DIR *dir;
+	int rc = 0;
 	char path[200];
 	struct dirent *de;
 	const int len = sizeof(path);