From patchwork Sat Jul 30 00:33:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9252997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 431996075F for ; Sat, 30 Jul 2016 00:36:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3320728442 for ; Sat, 30 Jul 2016 00:36:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276DF28446; Sat, 30 Jul 2016 00:36:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id A857F28442 for ; Sat, 30 Jul 2016 00:36:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bTIEO-0006kx-35; Sat, 30 Jul 2016 00:34:20 +0000 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bTIDr-0006Zs-RB for linux-arm-kernel@lists.infradead.org; Sat, 30 Jul 2016 00:33:49 +0000 Received: by mail-pa0-x229.google.com with SMTP id iw10so35328587pac.2 for ; Fri, 29 Jul 2016 17:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=R2/uQ83cwF8dhy93iW1lEIseBC8cuy9pBNGiHrqHqG4=; b=XshKnMLuBiCxURvsZzERiawmjCQ4aU1Nqa0KlH3NG6StH0uRMetv75O9RoQyW4YUTC 9YeSNaok0LGxkQ/Zfxa25dj0pMRbYTjCMiDx9UX+N6iu7J12CbEuTFRKmiX6iyazMwTv ZNnbBM1F4bB7vhRW5mLHvZ1d0JROQceSYpQiU= 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=R2/uQ83cwF8dhy93iW1lEIseBC8cuy9pBNGiHrqHqG4=; b=b2KkHn0ad6X/Uxr0kBImpnlfLYIUWBMlZ+DoAnxc5xkmJwSqUuPBWGIA+BZV0YrtWb sM5NeBG4Z76z0FNiR94MW+WYNb1NQMzEjuePyGy27XE1UP6+R9wSyHlb6xKQF3DKbJ7u WXNqQzGFKS1aLsIiYUGpanW7xlKZgR+NEAcotTuZD7Ukp1Wct3Nefwz582vf0PRfMfoc PvVOFBLYpAgODuE4z/elxGhnEr1KzdWNJnYPJIHhLuLYX3jKnP3YgodXjVftq3VwewnX xeGCIUNOFhg1B1eOzJZ4r5Iw5/KYq+jdUlcQzaCDrZw8prVCnSW2naelxRKdO2NjC6uu biTQ== X-Gm-Message-State: AEkooutcfR3kLUuOScSxMCM+pCDhdCre0HNzTaKKfg7ISFc6hidbojHsrYTPUmRPE2y8Mg3c X-Received: by 10.66.182.232 with SMTP id eh8mr73572875pac.146.1469838806985; Fri, 29 Jul 2016 17:33:26 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id o2sm27724157pfg.10.2016.07.29.17.33.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jul 2016 17:33:26 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH net-next 03/10] drivers: net: xgene: fix: Delete descriptor rings and buffer pools Date: Fri, 29 Jul 2016 17:33:56 -0700 Message-Id: <1469838843-19943-4-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469838843-19943-1-git-send-email-isubramanian@apm.com> References: <1469838843-19943-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160729_173348_006215_D9EBBB46 X-CRM114-Status: GOOD ( 10.86 ) 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: patches@apm.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, Iyappan Subramanian MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP xgene_enet_init_hw() should delete any descriptor rings and buffer pools setup should le_ops->cle_init() return an error. Signed-off-by: Iyappan Subramanian --- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 5246457..6fc5698 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -1464,10 +1464,8 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata) buf_pool = pdata->rx_ring[i]->buf_pool; xgene_enet_init_bufpool(buf_pool); ret = xgene_enet_refill_bufpool(buf_pool, pdata->rx_buff_cnt); - if (ret) { - xgene_enet_delete_desc_rings(pdata); - return ret; - } + if (ret) + goto err; } dst_ring_num = xgene_enet_dst_ring_num(pdata->rx_ring[0]); @@ -1484,7 +1482,7 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata) ret = pdata->cle_ops->cle_init(pdata); if (ret) { netdev_err(ndev, "Preclass Tree init error\n"); - return ret; + goto err; } } else { pdata->port_ops->cle_bypass(pdata, dst_ring_num, buf_pool->id); @@ -1494,6 +1492,10 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata) pdata->mac_ops->init(pdata); return ret; + +err: + xgene_enet_delete_desc_rings(pdata); + return ret; } static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata)