mpfs_ethernet.c: Release tx descriptor and rx buffer properly

Instead of releasing rx descriptor twice and tx buffer twice.
This commit is contained in:
Ville Juven 2023-10-16 13:19:13 +03:00 committed by Xiang Xiao
parent ee9e41f2dd
commit 3f878d8100

View File

@ -2805,10 +2805,10 @@ static void mpfs_buffer_free(struct mpfs_ethmac_s *priv, unsigned int queue)
#ifndef CONFIG_MPFS_GMAC_PREALLOCATE
/* Free allocated buffers */
if (priv->queue[queue].rx_desc_tab != NULL)
if (priv->queue[queue].tx_desc_tab != NULL)
{
kmm_free(priv->queue[queue].rx_desc_tab);
priv->queue[queue].rx_desc_tab = NULL;
kmm_free(priv->queue[queue].tx_desc_tab);
priv->queue[queue].tx_desc_tab = NULL;
}
if (priv->queue[queue].rx_desc_tab != NULL)
@ -2823,10 +2823,10 @@ static void mpfs_buffer_free(struct mpfs_ethmac_s *priv, unsigned int queue)
priv->queue[queue].txbuffer = NULL;
}
if (priv->queue[queue].txbuffer != NULL)
if (priv->queue[queue].rxbuffer != NULL)
{
kmm_free(priv->queue[queue].txbuffer);
priv->queue[queue].txbuffer = NULL;
kmm_free(priv->queue[queue].rxbuffer);
priv->queue[queue].rxbuffer = NULL;
}
#endif
}