From patchwork Fri Apr 18 11:59:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungho An X-Patchwork-Id: 4015191 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 61DEA9F319 for ; Fri, 18 Apr 2014 11:59:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E9DC203A9 for ; Fri, 18 Apr 2014 11:59:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 731522039D for ; Fri, 18 Apr 2014 11:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751404AbaDRL7o (ORCPT ); Fri, 18 Apr 2014 07:59:44 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:20181 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751269AbaDRL7k (ORCPT ); Fri, 18 Apr 2014 07:59:40 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4800K2O6NFDA30@mailout3.samsung.com>; Fri, 18 Apr 2014 20:59:39 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.50]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 17.64.10364.BA311535; Fri, 18 Apr 2014 20:59:39 +0900 (KST) X-AuditID: cbfee690-b7f266d00000287c-9e-535113abfef8 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id FD.2E.28157.BA311535; Fri, 18 Apr 2014 20:59:39 +0900 (KST) Received: from DObh74an01 ([12.36.166.149]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N4800DEI6NFWZ10@mmp1.samsung.com>; Fri, 18 Apr 2014 20:59:39 +0900 (KST) From: Byungho An To: netdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: davem@davemloft.net, ks.giri@samsung.com, vipul.pandya@samsung.com Subject: [PATCH] net: sxgbe: Added phy_found error path Date: Fri, 18 Apr 2014 20:59:39 +0900 Message-id: <000701cf5afd$ad1e65f0$075b31d0$%an@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac9a/a0FArZap+k8Q9S5mGbWgxqnRQ== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsVy+t8zI93VwoHBBhs2G1nMOd/CYtG74Cqb xfyjO5gsZpzfx2RxbIGYxbYFF5gd2Dy2rLzJ5NG3ZRWjx+dNcgHMUVw2Kak5mWWpRfp2CVwZ x7fOYi3oEKjYsfwLYwNjF28XIyeHhICJxIL238wQtpjEhXvr2UBsIYFljBI3jvPA1Cy6/oOl i5ELKL6IUaLj3jomCOc3o8TjzsuMIFVsAmoSzTMvg3WLCNhKLDnymR3EZhZwk9h/+TYriC0s YC6xZfUToEkcHCwCqhKPj+mChHkFbCTmb9jIDmELSvyYfI8FolVLYv3O40wQtrzE5jVvmUFa JQTUJR791YXYpCex628H1CYRiX0v3jGCnCYhsItdomf5KbAEi4CAxLfJh1ggemUlNh2A+ldS 4uCKGywTGMVmIdk8C8nmWUg2z0KyYgEjyypG0dSC5ILipPQiE73ixNzi0rx0veT83E2MkFib sIPx3gHrQ4zJQOsnMkuJJucDYzWvJN7Q2MzIwtTE1NjI3NKMNGElcV61R0lBQgLpiSWp2amp BalF8UW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1b1iy1MXbtZpOX/p+qxa53ypmOCo e2eUWIozEg21mIuKEwGOtbsZKQMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This patch adds phy_found error path when there is no phy device and changes bus_name. Signed-off-by: Byungho An --- drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c index 01af2cb..7dcaf1a 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c @@ -27,7 +27,7 @@ #define SXGBE_SMA_PREAD_CMD 0x02 /* post read increament address */ #define SXGBE_SMA_READ_CMD 0x03 /* read command */ #define SXGBE_SMA_SKIP_ADDRFRM 0x00040000 /* skip the address frame */ -#define SXGBE_MII_BUSY 0x00800000 /* mii busy */ +#define SXGBE_MII_BUSY 0x00400000 /* mii busy */ static int sxgbe_mdio_busy_wait(void __iomem *ioaddr, unsigned int mii_data) { @@ -147,6 +147,7 @@ int sxgbe_mdio_register(struct net_device *ndev) struct sxgbe_mdio_bus_data *mdio_data = priv->plat->mdio_bus_data; int err, phy_addr; int *irqlist; + bool phy_found = false; bool act; /* allocate the new mdio bus */ @@ -162,7 +163,7 @@ int sxgbe_mdio_register(struct net_device *ndev) irqlist = priv->mii_irq; /* assign mii bus fields */ - mdio_bus->name = "samsxgbe"; + mdio_bus->name = "sxgbe"; mdio_bus->read = &sxgbe_mdio_read; mdio_bus->write = &sxgbe_mdio_write; snprintf(mdio_bus->id, MII_BUS_ID_SIZE, "%s-%x", @@ -216,13 +217,22 @@ int sxgbe_mdio_register(struct net_device *ndev) netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n", phy->phy_id, phy_addr, irq_str, dev_name(&phy->dev), act ? " active" : ""); + phy_found = true; } } + if (!phy_found) { + netdev_err(ndev, "PHY not found\n"); + goto phyfound_err; + } + priv->mii = mdio_bus; return 0; +phyfound_err: + err = -ENODEV; + mdiobus_unregister(mdio_bus); mdiobus_err: mdiobus_free(mdio_bus); return err;