From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <david.hunt@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id A0AB05F33
 for <dev@dpdk.org>; Wed, 26 Sep 2018 15:41:27 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 26 Sep 2018 06:41:25 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.54,306,1534834800"; d="scan'208";a="83404383"
Received: from silpixa00399952.ir.intel.com (HELO
 silpixa00399952.ger.corp.intel.com) ([10.237.223.64])
 by FMSMGA003.fm.intel.com with ESMTP; 26 Sep 2018 06:41:22 -0700
From: David Hunt <david.hunt@intel.com>
To: dev@dpdk.org
Cc: john.mcnamara@intel.com, stephen@networkplumber.org, lei.a.yao@intel.com,
 anatoly.burakov@intel.com, David Hunt <david.hunt@intel.com>
Date: Wed, 26 Sep 2018 14:40:28 +0100
Message-Id: <20180926134037.43606-3-david.hunt@intel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20180926134037.43606-1-david.hunt@intel.com>
References: <20180914135406.52190-1-david.hunt@intel.com>
 <20180926134037.43606-1-david.hunt@intel.com>
Subject: [dpdk-dev] [PATCH v4 02/11] examples/power: allow for number of vms
	to be zero
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 26 Sep 2018 13:41:28 -0000

Previously the vm_power_manager app required to have some vms defined, so
the call to get_all_vm() always set the noVms variable. Now we're accepting
policies from the host OS (without any VMs defined), so it is now valid to
have zero VMs. This patch initialises the relevant variables to zero just
in case the call to get_all_vms() does not find any, so could return with
the variables uninitialised.

Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 7fa47ba97..f180d74e6 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -66,7 +66,7 @@ static void
 core_share_status(int pNo)
 {
 
-	int noVms, noVcpus, z, x, t;
+	int noVms = 0, noVcpus = 0, z, x, t;
 
 	get_all_vm(&noVms, &noVcpus);
 
-- 
2.17.1