diff mbox

[ndctl,1/3] ndctl, inject-smart: cleanup uninitialized variable warnings

Message ID 20180221230252.16632-2-vishal.l.verma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Verma, Vishal L Feb. 21, 2018, 11:02 p.m. UTC
There were a couple of cases where we could try to unref a command that
had never been initialized. Fix those by always initializing the cmd
pointers to NULL.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/inject-smart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/ndctl/inject-smart.c b/ndctl/inject-smart.c
index 02f8b0e..45dbc8d 100644
--- a/ndctl/inject-smart.c
+++ b/ndctl/inject-smart.c
@@ -221,7 +221,7 @@  static int smart_init(void)
 static int smart_set_thresh(struct ndctl_dimm *dimm)
 {
 	const char *name = ndctl_dimm_get_devname(dimm);
-	struct ndctl_cmd *st_cmd, *sst_cmd;
+	struct ndctl_cmd *st_cmd = NULL, *sst_cmd = NULL;
 	int rc = -EOPNOTSUPP;
 
 	st_cmd = ndctl_dimm_cmd_new_smart_threshold(dimm);
@@ -332,7 +332,7 @@  out:
 static int smart_inject(struct ndctl_dimm *dimm)
 {
 	const char *name = ndctl_dimm_get_devname(dimm);
-	struct ndctl_cmd *si_cmd;
+	struct ndctl_cmd *si_cmd = NULL;
 	int rc = -EOPNOTSUPP;
 
 	send_inject_val(media_temperature)