Skip to content

Commit 731e6f0

Browse files
tititiou36davem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0d7eacb commit 731e6f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/ti/cpmac.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,10 @@ static int cpmac_open(struct net_device *dev)
10061006
kfree_skb(priv->rx_head[i].skb);
10071007
}
10081008
}
1009+
dma_free_coherent(&dev->dev, sizeof(struct cpmac_desc) * size,
1010+
priv->desc_ring, priv->dma_ring);
1011+
10091012
fail_alloc:
1010-
kfree(priv->desc_ring);
10111013
iounmap(priv->regs);
10121014

10131015
fail_remap:

0 commit comments

Comments
 (0)