From patchwork Thu Jan 28 21:25:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8154241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 58888BEEE5 for ; Thu, 28 Jan 2016 21:42:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E7D22020F for ; Thu, 28 Jan 2016 21:42:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAE57201C8 for ; Thu, 28 Jan 2016 21:42:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOuJO-0003GE-Le; Thu, 28 Jan 2016 21:41:06 +0000 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOu7w-00063t-A2 for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 21:29:17 +0000 Received: by mail-pf0-x235.google.com with SMTP id o185so25030530pfb.1 for ; Thu, 28 Jan 2016 13:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Xe9GFMjFGgOcpKw5GhZiHadAtCqBfX3JPAV/FEtQLKQ=; b=Ny3BMyYIYb7KSdirv5/wTRrirTcLnpH6ALQ0ZQ5Yg5Q7BzVe97YoJ2WYxL8LegrnLV CHgXcjP4gO4r/DQNB18wg8Mi+95CRyX5aXinkCPO+Ik37gefm7Z/+lH2bFd6r982QJKE tBwIfQMzNPp8eMky/Kt1ESyQGLi50pUgek6io2YIwdbv02nOhZk6lrLGXU1vlYCnrEIp s1jy1dk/mtir4nOShiTQ7xm72/bBpLJyjQ9IbFTcmbnS5GxEUImwUHJpc9xg/jOqsHQK uMvhcpQ0RZl5VD1j3qUiGbEa3+jCrNeyc1PZCbmIH/ZRK2tyhEityjo6nRPZI5t8UxMK ykyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Xe9GFMjFGgOcpKw5GhZiHadAtCqBfX3JPAV/FEtQLKQ=; b=kwPRfZ5kdHnEyAQEelf2uUe7B/yNfpI3l7nU3Yv6+aTo+3Pyt9eHHJKxLuN84i9ioY DymJwYKmd4A0V+t21FZHZT5c6Gc5MhmDwGsrH4ZWH1yLpZHCHBFFq9qtBH9Q/CpP2MZW IemkHONtmGwu/SbBGlNwQTnTg6v26XM4KiB8ahrOSoJIYNBFGSztlhqTpZyuikzODX20 RyCGiC9drbdUcOmJcosWOxOsGAokEfbcH54Qb9iokOZEFI2aQ+G1hWQn/LTgikBWs9rK Yw1po1cjkFNj15o8a5bYBGvfxS2/WvjOVFJcIrjOyJ6ScSdnxPlXZUu/Eas8QDyLoLXS 53sg== X-Gm-Message-State: AG10YOQtJLf1ftopJPGYytcaGMlBkLoI3l7bk3AJ9F5k10CgML01p8fsFPgfxATU8l3AaA== X-Received: by 10.98.14.29 with SMTP id w29mr7889615pfi.160.1454016535950; Thu, 28 Jan 2016 13:28:55 -0800 (PST) Received: from localhost.localdomain (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by smtp.googlemail.com with ESMTPSA id c90sm18583190pfd.31.2016.01.28.13.28.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jan 2016 13:28:55 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next 28/40] net: fec: unmap initial buffer on error Date: Thu, 28 Jan 2016 14:25:52 -0700 Message-Id: <1454016364-30985-29-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454016364-30985-1-git-send-email-troy.kisky@boundarydevices.com> References: <1454016364-30985-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160128_132916_530752_957304F4 X-CRM114-Status: UNSURE ( 9.70 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fabio.estevam@freescale.com, andrew@lunn.ch, linux@arm.linux.org.uk, Troy Kisky , laci@boundarydevices.com, l.stach@pengutronix.de, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org, tremyfr@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Troy Kisky --- drivers/net/ethernet/freescale/fec_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 7258051..e141f6f 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -404,7 +404,6 @@ dma_mapping_error: bdp->cbd_datlen, DMA_TO_DEVICE); bdp->cbd_bufaddr = 0; } - dev_kfree_skb_any(skb); return ERR_PTR(-ENOMEM); } @@ -466,8 +465,12 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq, ((bdp == txq->bd.last) ? BD_SC_WRAP : 0); if (nr_frags) { last_bdp = fec_enet_txq_submit_frag_skb(txq, skb, ndev); - if (IS_ERR(last_bdp)) + if (IS_ERR(last_bdp)) { + dma_unmap_single(&fep->pdev->dev, addr, + buflen, DMA_TO_DEVICE); + dev_kfree_skb_any(skb); return NETDEV_TX_OK; + } } else { status |= (BD_ENET_TX_INTR | BD_ENET_TX_LAST); if (fep->bufdesc_ex) {