diff --git a/arch/risc-v/src/mpfs/mpfs_ethernet.c b/arch/risc-v/src/mpfs/mpfs_ethernet.c index 1587803bee6..fe764c27e70 100644 --- a/arch/risc-v/src/mpfs/mpfs_ethernet.c +++ b/arch/risc-v/src/mpfs/mpfs_ethernet.c @@ -1180,6 +1180,13 @@ static void mpfs_txreset(struct mpfs_ethmac_s *priv) priv->queue[qi].txhead = 0; priv->queue[qi].txtail = 0; + if (!txdesc || !txbuffer) + { + /* The queue index is not set up */ + + continue; + } + for (ndx = 0; ndx < CONFIG_MPFS_ETHMAC_NTXBUFFERS; ndx++) { bufaddr = (uintptr_t)&txbuffer[ndx * GMAC_TX_UNITSIZE]; @@ -1255,6 +1262,13 @@ static void mpfs_rxreset(struct mpfs_ethmac_s *priv) rxdesc = priv->queue[qi].rx_desc_tab; priv->queue[qi].rxndx = 0; + if (!rxdesc || !rxbuffer) + { + /* The queue index is not set up */ + + continue; + } + for (ndx = 0; ndx < CONFIG_MPFS_ETHMAC_NRXBUFFERS; ndx++) { bufaddr = (uintptr_t)&rxbuffer[ndx * GMAC_RX_UNITSIZE];