This error is seen in build of type "minsize":

drivers/net/softnic/rte_eth_softnic_thread.c:275:16: error:
'rsp' may be used uninitialized [-Werror=maybe-uninitialized]
drivers/net/softnic/rte_eth_softnic_thread.c:500:20: error:
'req' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because the ring dequeue status
is checked before the values are used.

The variables are initialized to allow compiling with "minsize" option.

Fixes: 70709c78fda6 ("net/softnic: add command to enable/disable pipeline")
Fixes: 5719a615dc02 ("net/softnic: add run API")

Signed-off-by: Cheryl Bansal <[email protected]>
---
 drivers/net/softnic/rte_eth_softnic_thread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c 
b/drivers/net/softnic/rte_eth_softnic_thread.c
index a6d47c8b33..1e7fa4cf65 100644
--- a/drivers/net/softnic/rte_eth_softnic_thread.c
+++ b/drivers/net/softnic/rte_eth_softnic_thread.c
@@ -259,7 +259,7 @@ thread_msg_send_recv(struct pmd_internals *softnic,
        struct softnic_thread *t = &softnic->thread[thread_id];
        struct rte_ring *msgq_req = t->msgq_req;
        struct rte_ring *msgq_rsp = t->msgq_rsp;
-       struct thread_msg_rsp *rsp;
+       struct thread_msg_rsp *rsp = NULL;
        int status;
 
        /* send */
@@ -425,7 +425,7 @@ softnic_thread_pipeline_disable(struct pmd_internals 
*softnic,
 static inline struct thread_msg_req *
 thread_msg_recv(struct rte_ring *msgq_req)
 {
-       struct thread_msg_req *req;
+       struct thread_msg_req *req = NULL;
 
        int status = rte_ring_sc_dequeue(msgq_req, (void **)&req);
 
-- 
2.43.0

Reply via email to