From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752072AbcGQGQG (ORCPT ); Sun, 17 Jul 2016 02:16:06 -0400 Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:42351 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750921AbcGQGQD convert rfc822-to-8bit (ORCPT ); Sun, 17 Jul 2016 02:16:03 -0400 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 17 Jul 2016 08:15:59 +0200 X-ME-IP: 92.140.225.101 From: Christophe JAILLET To: florian@openwrt.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] net: ti: cpmac: Use the correct function to free some resources. Date: Sun, 17 Jul 2016 08:15:50 +0200 Message-Id: <1468736150-30111-1-git-send-email-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Antivirus: avast! (VPS 160716-0, 16/07/2016), Outbound message X-Antivirus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Un-compiled (I don't have the configuration for that) and un-tested --- drivers/net/ethernet/ti/cpmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c index 7eef45e..56c8920 100644 --- a/drivers/net/ethernet/ti/cpmac.c +++ b/drivers/net/ethernet/ti/cpmac.c @@ -1032,8 +1032,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: -- 2.7.4 --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus