[v2,09/10] net/ifc: fix maybe-uninitialized warnings for LTO build

Message ID 20190917075754.8310-10-amo@semihalf.com
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • Add an option to use LTO for DPDK build
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Andrzej Ostruszka Sept. 17, 2019, 7:57 a.m.
During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
---
 drivers/net/ifc/ifcvf_vdpa.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
index 8de9ef199..4cdff8712 100644
--- a/drivers/net/ifc/ifcvf_vdpa.c
+++ b/drivers/net/ifc/ifcvf_vdpa.c
@@ -304,8 +304,8 @@  vdpa_ifcvf_stop(struct ifcvf_internal *internal)
 	struct ifcvf_hw *hw = &internal->hw;
 	uint32_t i;
 	int vid;
-	uint64_t features;
-	uint64_t log_base, log_size;
+	uint64_t features = 0;
+	uint64_t log_base = 0, log_size = 0;
 	uint64_t len;
 
 	vid = internal->vid;
@@ -348,6 +348,8 @@  vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 	struct rte_vhost_vring vring;
 	int fd;
 
+	vring.callfd = -1;
+
 	nr_vring = rte_vhost_get_vring_num(internal->vid);
 
 	irq_set = (struct vfio_irq_set *)irq_set_buf;
@@ -442,6 +444,7 @@  notify_relay(void *arg)
 	}
 	internal->epfd = epfd;
 
+	vring.kickfd = -1;
 	for (qid = 0; qid < q_num; qid++) {
 		ev.events = EPOLLIN | EPOLLPRI;
 		rte_vhost_get_vhost_vring(internal->vid, qid, &vring);
@@ -577,7 +580,7 @@  m_ifcvf_start(struct ifcvf_internal *internal)
 	struct ifcvf_hw *hw = &internal->hw;
 	uint32_t i, nr_vring;
 	int vid, ret;
-	struct rte_vhost_vring vq;
+	struct rte_vhost_vring vq = { 0 };
 	void *vring_buf;
 	uint64_t m_vring_iova = IFCVF_MEDIATED_VRING;
 	uint64_t size;
@@ -721,6 +724,7 @@  vring_relay(void *arg)
 	}
 	internal->epfd = epfd;
 
+	vring.kickfd = -1;
 	for (qid = 0; qid < q_num; qid++) {
 		ev.events = EPOLLIN | EPOLLPRI;
 		rte_vhost_get_vhost_vring(vid, qid, &vring);
@@ -930,11 +934,11 @@  ifcvf_dev_close(int vid)
 static int
 ifcvf_set_features(int vid)
 {
-	uint64_t features;
+	uint64_t features = 0;
 	int did;
 	struct internal_list *list;
 	struct ifcvf_internal *internal;
-	uint64_t log_base, log_size;
+	uint64_t log_base = 0, log_size = 0;
 
 	did = rte_vhost_get_vdpa_device_id(vid);
 	list = find_internal_resource_by_did(did);