./drivers/net/mvneta/mvneta_rxtx.c:89:42:
        error: 'mbufs' may be used uninitialized [-Werror=maybe-uninitialized]
   89 |         MVNETA_SET_COOKIE_HIGH_ADDR(mbufs[0]);
      |                                          ^
../drivers/net/mvneta/mvneta_rxtx.c:77:26: note: 'mbufs' declared here
   77 |      struct rte_mbuf *mbufs[MRVL_NETA_BUF_RELEASE_BURST_SIZE_MAX];
      |                       ^~~~~

Fixes: ce7ea764597e ("net/mvneta: support Rx/Tx")
Cc: sta...@dpdk.org

Signed-off-by: Amit Prakash Shukla <amitpraka...@marvell.com>
---
 drivers/net/mvneta/mvneta_rxtx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mvneta/mvneta_rxtx.c b/drivers/net/mvneta/mvneta_rxtx.c
index 6e4a7896b4..952e982275 100644
--- a/drivers/net/mvneta/mvneta_rxtx.c
+++ b/drivers/net/mvneta/mvneta_rxtx.c
@@ -79,6 +79,10 @@ mvneta_buffs_refill(struct mvneta_priv *priv, struct 
mvneta_rxq *rxq, u16 *num)
        int i, ret;
        uint16_t nb_desc = *num;
 
+       /* To prevent GCC-12 warning. */
+       if (unlikely(nb_desc == 0))
+               return -1;
+
        ret = rte_pktmbuf_alloc_bulk(rxq->mp, mbufs, nb_desc);
        if (ret) {
                MVNETA_LOG(ERR, "Failed to allocate %u mbufs.", nb_desc);
-- 
2.25.1

Reply via email to