Re: [PATCH] net: gemini: Fix memory leak in gmac_setup_txqs

From: Markus Elfring
Date: Sun Dec 15 2019 - 09:28:09 EST


> +++ b/drivers/net/ethernet/cortina/gemini.c
> @@ -576,6 +576,8 @@ static int gmac_setup_txqs(struct net_device *netdev)
>
> if (port->txq_dma_base & ~DMA_Q_BASE_MASK) {
> dev_warn(geth->dev, "TX queue base is not aligned\n");
> + dma_free_coherent(geth->dev, len * sizeof(*desc_ring),
> + desc_ring, port->txq_dma_base);
> kfree(skb_tab);
> return -ENOMEM;
> }

The added function call seems to be fine.
Would you like to avoid a bit of duplicate code for the exception handling?

Regards,
Markus