net/mvneta: fix build with GCC 12

./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: ce7ea76459 ("net/mvneta: support Rx/Tx")
Cc: stable@dpdk.org

Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Acked-by: Liron Himi <lironh@marvell.com>
This commit is contained in:
Amit Prakash Shukla 2022-09-01 14:01:18 +05:30 committed by Jerin Jacob
parent dac480837c
commit d7b080f1e7

View File

@ -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);