OSDN Git Service

dpaa_eth: Fix one possible memleak in dpaa_eth_probe
authorLiu Jian <liujian56@huawei.com>
Mon, 20 Jul 2020 14:28:29 +0000 (22:28 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2020 00:54:08 +0000 (17:54 -0700)
When dma_coerce_mask_and_coherent() fails, the alloced netdev need to be freed.

Fixes: 060ad66f9795 ("dpaa_eth: change DMA device")
Signed-off-by: Liu Jian <liujian56@huawei.com>
Acked-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

index 2972244..43570f4 100644 (file)
@@ -2938,7 +2938,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
                                                   DMA_BIT_MASK(40));
        if (err) {
                netdev_err(net_dev, "dma_coerce_mask_and_coherent() failed\n");
-               return err;
+               goto free_netdev;
        }
 
        /* If fsl_fm_max_frm is set to a higher value than the all-common 1500,