From patchwork Fri Aug 25 22:23:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9923031 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 9585D60349 for ; Fri, 25 Aug 2017 22:26:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 881762853F for ; Fri, 25 Aug 2017 22:26:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B7D328544; Fri, 25 Aug 2017 22:26: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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ECA5D2853F for ; Fri, 25 Aug 2017 22:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=N4P/PuK13K2oenapMSK7Cf5vqvsphkVcsQ4O2SkxFxQ=; b=igmqi3inFcR2Qqz2Vuhhojb9C0 tLdsfE5yoSGXaLXvjpz1yYOM8EBY/4xxLhtMg7Sn/P22eNP/ykDivW+ScWO/2Dqt885IK5q+o13Cv /gqKlAEmsniRt6VuUe2egwnesSq/mGFAP41WsGpAlK+ajyCYe/5SXtogEEeVT4NvY1xU9W6m0aB90 JCYhavZmygex9SrgFIgRTDAk9Skjj4qJwq/ePNNPi12IVd8aJbxH25QlpxQ7IE7rsxqAIgC8qsCna 8i3D/w50Q5Xqll2Azp1UUYMfKlOd+dbu5THENlxp9njzezqkiikNfjD+Z1f6HEAh6k2JLUrubgg6X bKhjBmig==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dlN30-0004qE-DB; Fri, 25 Aug 2017 22:25:50 +0000 Received: from mail-pg0-x233.google.com ([2607:f8b0:400e:c05::233]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dlN1Q-0002Lw-NO for linux-arm-kernel@lists.infradead.org; Fri, 25 Aug 2017 22:24:15 +0000 Received: by mail-pg0-x233.google.com with SMTP id a7so5780133pgn.1 for ; Fri, 25 Aug 2017 15:23:48 -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=TpAWZn2aLl6SBtbyAVvw6mlUIyJkdVqlBfZk/Sw02XU=; b=SSgYLZ8Exqf9kj1oERaLJHGz+l4NHwVvCU73x4Vc4//BMbNF1cdnS4s0Vv3WxZEtQA 82F1HLSLOwPAcdbHKL2U8tuO6vuLFprLW4Q5S21ILJoRZwLqxsmOOI2lS5BZ9hK08qUm 0uLR6ZJKFwdyzIGjhxL3+a8dzW+KOiQuwLABs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TpAWZn2aLl6SBtbyAVvw6mlUIyJkdVqlBfZk/Sw02XU=; b=tU2xTvDbJ6huOUu3dEeZPzF7LNufF8H8mjgjkdjlbLX5r0DdqaWS/W75/sowArtxFC CRZjyCRo8zd/qtWmOvcBZmAyT0jwthM4NPMOA2WcATqTFDruuEcEmqExK23uOxl3UWy8 zAicneltGCdLhdIJxAgwwSUIrxmgn48nM9NGkOpD4pyaezMsj5/emn22yQ8T5rR1ECdy Nhb86/vIe6AulKNig3jq/8QJFd8uBXRbHxOKowWHQi4mldo2HLLdQcHmDQuQMDZu9OEn 7MSAccJQKjrffre6sHeG8C8rUixuWHl+PQKdwVItg1PXNgljNcs08QJMm5Eu/APfAKD4 2geA== X-Gm-Message-State: AHYfb5jkxqZCFrApAZRvvbXZAzGMcuX/ROVob227/6gm/Pu4jDacW6SA QXjA0sVtX9NfGZty X-Received: by 10.98.220.93 with SMTP id t90mr11380756pfg.158.1503699827977; Fri, 25 Aug 2017 15:23:47 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id c80sm13889519pfj.26.2017.08.25.15.23.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Aug 2017 15:23:46 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH 1/2] drivers: net: xgene: Correct probe sequence handling Date: Fri, 25 Aug 2017 15:23:29 -0700 Message-Id: <1503699810-12803-2-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503699810-12803-1-git-send-email-isubramanian@apm.com> References: <1503699810-12803-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170825_152412_821429_03044876 X-CRM114-Status: GOOD ( 13.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qnguyen@apm.com, dnelson@redhat.com, patches@apm.com, 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 From: Quan Nguyen The phy is connected at early stage of probe but not properly disconnected if error occurs. This patch fixes the issue. Also changing the return type of xgene_enet_check_phy_handle(), since this function always returns success. Signed-off-by: Quan Nguyen Signed-off-by: Iyappan Subramanian --- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 27 ++++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 1d307f2..6e253d9 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -1661,21 +1661,21 @@ static int xgene_enet_get_irqs(struct xgene_enet_pdata *pdata) return 0; } -static int xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata) +static void xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata) { int ret; if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) - return 0; + return; if (!IS_ENABLED(CONFIG_MDIO_XGENE)) - return 0; + return; ret = xgene_enet_phy_connect(pdata->ndev); if (!ret) pdata->mdio_driver = true; - return 0; + return; } static void xgene_enet_gpiod_get(struct xgene_enet_pdata *pdata) @@ -1779,10 +1779,6 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) if (ret) return ret; - ret = xgene_enet_check_phy_handle(pdata); - if (ret) - return ret; - xgene_enet_gpiod_get(pdata); pdata->clk = devm_clk_get(&pdev->dev, NULL); @@ -2097,9 +2093,11 @@ static int xgene_enet_probe(struct platform_device *pdev) goto err; } + xgene_enet_check_phy_handle(pdata); + ret = xgene_enet_init_hw(pdata); if (ret) - goto err; + goto err2; link_state = pdata->mac_ops->link_state; if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { @@ -2117,29 +2115,30 @@ static int xgene_enet_probe(struct platform_device *pdev) spin_lock_init(&pdata->stats_lock); ret = xgene_extd_stats_init(pdata); if (ret) - goto err2; + goto err1; xgene_enet_napi_add(pdata); ret = register_netdev(ndev); if (ret) { netdev_err(ndev, "Failed to register netdev\n"); - goto err2; + goto err1; } return 0; -err2: +err1: /* * If necessary, free_netdev() will call netif_napi_del() and undo * the effects of xgene_enet_napi_add()'s calls to netif_napi_add(). */ + xgene_enet_delete_desc_rings(pdata); + +err2: if (pdata->mdio_driver) xgene_enet_phy_disconnect(pdata); else if (phy_interface_mode_is_rgmii(pdata->phy_mode)) xgene_enet_mdio_remove(pdata); -err1: - xgene_enet_delete_desc_rings(pdata); err: free_netdev(ndev); return ret;