net: ti: cpmac: Use the correct function to free some resources.

In 'cpmac_open', 'dma_alloc_coherent' has been used to allocate some
resources, so we need to free them using 'dma_free_coherent' instead
of 'kfree'.

Also, we don't need to free these resources if the allocation has failed.
So I have slighly modified the goto label in this case.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christophe Jaillet 2016-07-17 08:15:50 +02:00 committed by David S. Miller
parent 0d7eacbe63
commit 731e6f007a

View File

@ -1006,8 +1006,10 @@ fail_desc:
kfree_skb(priv->rx_head[i].skb); kfree_skb(priv->rx_head[i].skb);
} }
} }
dma_free_coherent(&dev->dev, sizeof(struct cpmac_desc) * size,
priv->desc_ring, priv->dma_ring);
fail_alloc: fail_alloc:
kfree(priv->desc_ring);
iounmap(priv->regs); iounmap(priv->regs);
fail_remap: fail_remap: