Skip to content

Commit

Permalink
net/mvneta: fix build with GCC 12
Browse files Browse the repository at this point in the history
[ upstream commit d7b080f ]

./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: ce7ea76 ("net/mvneta: support Rx/Tx")

Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Acked-by: Liron Himi <lironh@marvell.com>
  • Loading branch information
Amit Prakash Shukla authored and kevintraynor committed Oct 11, 2022
1 parent a2439f5 commit 6d03055
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/mvneta/mvneta_rxtx.c
Expand Up @@ -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);
Expand Down

0 comments on commit 6d03055

Please sign in to comment.