netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net: fec: use managed DMA API functions to allocate BD ring
@ 2015-07-20 13:51 Lucas Stach
  2015-07-20 13:51 ` [PATCH 2/2] net: fec: introduce fec_ptp_stop and use in probe fail path Lucas Stach
  2015-07-21  7:32 ` [PATCH 1/2] net: fec: use managed DMA API functions to allocate BD ring David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Lucas Stach @ 2015-07-20 13:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: Duan Andy, Frank Li, netdev, kernel, patchwork-lst

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>
---
 drivers/net/ethernet/freescale/fec_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 349365d85b92..b3287c6b069b 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3142,7 +3142,7 @@ 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,
+	cbd_base = dmam_alloc_coherent(&fep->pdev->dev, bd_size, &bd_dma,
 				      GFP_KERNEL);
 	if (!cbd_base) {
 		return -ENOMEM;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-21  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20 13:51 [PATCH 1/2] net: fec: use managed DMA API functions to allocate BD ring Lucas Stach
2015-07-20 13:51 ` [PATCH 2/2] net: fec: introduce fec_ptp_stop and use in probe fail path Lucas Stach
2015-07-21  7:32 ` [PATCH 1/2] net: fec: use managed DMA API functions to allocate BD ring David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).