From: Christophe Jaillet Date: Sun, 17 Jul 2016 06:15:50 +0000 (+0200) Subject: net: ti: cpmac: Use the correct function to free some resources. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=731e6f007aa2d07fc1a420bffeb7c9e8226e89e6;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c index f86497c2888a..29f381b16a44 100644 --- a/drivers/net/ethernet/ti/cpmac.c +++ b/drivers/net/ethernet/ti/cpmac.c @@ -1006,8 +1006,10 @@ fail_desc: kfree_skb(priv->rx_head[i].skb); } } + dma_free_coherent(&dev->dev, sizeof(struct cpmac_desc) * size, + priv->desc_ring, priv->dma_ring); + fail_alloc: - kfree(priv->desc_ring); iounmap(priv->regs); fail_remap: