Skip to content

Commit

Permalink
net: fec: use managed DMA API functions to allocate BD ring
Browse files Browse the repository at this point in the history
So it gets freed when the device is going away.
This fixes a DMA memory leak on driver probe() fail and driver
remove().

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lucas Stach authored and David S. Miller committed Jul 27, 2015
1 parent 4228883 commit c0a1a0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3115,8 +3115,8 @@ static int fec_enet_init(struct net_device *ndev)
fep->bufdesc_size;

/* Allocate memory for buffer descriptors. */
cbd_base = dma_alloc_coherent(NULL, bd_size, &bd_dma,
GFP_KERNEL);
cbd_base = dmam_alloc_coherent(&fep->pdev->dev, bd_size, &bd_dma,
GFP_KERNEL);
if (!cbd_base) {
return -ENOMEM;
}
Expand Down

0 comments on commit c0a1a0a

Please sign in to comment.