From: Andrzej Ostruszka Date: Thu, 7 Nov 2019 15:03:17 +0000 (+0100) Subject: net/ifc: clean LTO warnings X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=da08a9355f82b33a2b3940ac330ed53cf54e4937;p=dpdk.git net/ifc: clean LTO warnings During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: ‘features’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (RTE_VHOST_NEED_LOG(features)) { Signed-off-by: Andrzej Ostruszka --- diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c index 8de9ef1999..9c562def05 100644 --- a/drivers/net/ifc/ifcvf_vdpa.c +++ b/drivers/net/ifc/ifcvf_vdpa.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -304,8 +305,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 +349,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 +445,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); @@ -583,6 +587,7 @@ m_ifcvf_start(struct ifcvf_internal *internal) uint64_t size; uint64_t gpa; + memset(&vq, 0, sizeof(vq)); vid = internal->vid; nr_vring = rte_vhost_get_vring_num(vid); rte_vhost_get_negotiated_features(vid, &hw->req_features); @@ -721,6 +726,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 +936,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);