]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: fec: use managed DMA API functions to allocate BD ring
authorLucas Stach <l.stach@pengutronix.de>
Thu, 23 Jul 2015 14:06:19 +0000 (16:06 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jul 2015 04:51:53 +0000 (21:51 -0700)
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>
drivers/net/ethernet/freescale/fec_main.c

index 1f89c59b43535f9b65e946c7468cb1fcb13a2022..2945b62b6dc53483152ecce72487c1b1c0fd4297 100644 (file)
@@ -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;
        }