From patchwork Wed Feb 21 23:02:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 10234305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 021A160385 for ; Wed, 21 Feb 2018 23:03:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E809428555 for ; Wed, 21 Feb 2018 23:02:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC72728571; Wed, 21 Feb 2018 23:02:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8606528555 for ; Wed, 21 Feb 2018 23:02:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 51CC420954CA9; Wed, 21 Feb 2018 14:56:59 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=vishal.l.verma@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0EC712034D8D4 for ; Wed, 21 Feb 2018 14:56:57 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2018 15:02:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,376,1515484800"; d="scan'208";a="19307209" Received: from vverma7-desk1.lm.intel.com ([10.232.112.218]) by fmsmga007.fm.intel.com with ESMTP; 21 Feb 2018 15:02:56 -0800 From: Vishal Verma To: Subject: [ndctl PATCH 1/3] ndctl, inject-smart: cleanup uninitialized variable warnings Date: Wed, 21 Feb 2018 16:02:50 -0700 Message-Id: <20180221230252.16632-2-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180221230252.16632-1-vishal.l.verma@intel.com> References: <20180221230252.16632-1-vishal.l.verma@intel.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Vishal Verma --- ndctl/inject-smart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)