From patchwork Mon Dec 18 09:44:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10118645 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 AE58E603FA for ; Mon, 18 Dec 2017 09:46:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FF5328D28 for ; Mon, 18 Dec 2017 09:46:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9493728DEB; Mon, 18 Dec 2017 09:46:49 +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.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable 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 2821428D28 for ; Mon, 18 Dec 2017 09:46:49 +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=C8MY+Ev06Olw9Bhn2UqAtbJvmt/+ExX4HygncG93ZT4=; b=V+gW6bCLVbD0i9J8vHtNyOgK9P NwfVRx7D4xJJPrR5vFD+uBZhBugfMRKa1UzyJdSmEwLCVNiHPyopewXSDA1Q1dAqvywS52/02XZ90 jktqKeOQJQyk9Gk4PpOSetOnrExji5meea70dyvYmpQt/GFqtWWaT6qOqcm/7xrK+oMvzG//EzPqQ RZCFG/T+ngGrHpkqwanVfNgZuOnYvyaKO9bVCtinm43YXr/IlgHg7aHIYTlwsRGkNZjthKrfm3C+Y YO1ScVXcRGrlZEXZ0YKDaIkbK+QLsL04pKcx7UDHqD0r8d5xPGHELTAPgBD1p1ZTqC3eU2C1fwB++ nZXokRSA==; 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 1eQs0W-0007LE-4F; Mon, 18 Dec 2017 09:46:48 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eQrz1-0004fW-9Q for linux-arm-kernel@lists.infradead.org; Mon, 18 Dec 2017 09:45:29 +0000 Received: by mail-wm0-x244.google.com with SMTP id 9so27859904wme.4 for ; Mon, 18 Dec 2017 01:44:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=69M9Tk3sFtCpyNWDmoteGESV5/X+JnhQXIYqKSnGztU=; b=DC99hJIRuj/R5QwZQfzwJIq7FKEOlxXQx871nUKdT2pk5PMZPqIfJk1qmQccKZWCGn 6DQDPFEvzJOpghs28NNEhqp296R5+j9ZtHZruVZQ/yAx5sOXWFhYJodiQRcF+BAPnScJ 6wdkDmnvjyNCU4ZW/gvUmgx79rK2lMBlQE/9b1n07JkxEpGO+EWWw9ac88njsIwZZOmc x+vm8EvuLyJikBBxoBX/gnkgglkr3nrGKqHVWS+8Zf0oWzG+hwErJ9Sm0dquJ8YIFez2 IbrKIopXmfb7tbPzX2FqUsPQZN8QXJf+DwR50Y7M4/shfi8bImbNjJl8zR0im+Vimwh2 jrFA== 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=69M9Tk3sFtCpyNWDmoteGESV5/X+JnhQXIYqKSnGztU=; b=owg4yQCteO8kPYzEeWvWfZplkslt22SgLiTOc9bK4PnLYayiUXzKLIeHDznIoJAP3D ka/9CVavaIHtusfuWOcLGgVgAQNCVh05vUsDbmkIEVDSmoj6fItCuyQsPgufhosD9hg4 UVd6o6yOz63CemsFm1PUuobPMtHMcH5S/jrbxS2wlqbzrrbCsbbxf79CSmY6whxlr4AJ RawbjO5DBhX5+auFmNP40f+LLNMIM5fhA3jRZJE732pdT4YfcIZjQ5Ub7RZejKH8EqUl iu6z50kLSXYUsefWLCSBDPE2Ru78vvtylQm+A8L2baEQu0sSDs0eub5iHaeE8mL4xBnW cSpA== X-Gm-Message-State: AKGB3mJqsQg9tul7oLHpwTuCtqHAE2sR0OSs9SnRCDpev1Q1j51BwZUn K84KgDEWwKpCQMVVdp47mPE6PzP2 X-Google-Smtp-Source: ACJfBovyxS8qw1c0+k7XsHtvYhmaXs6H/w8IWvatCYZPwTZT6JpBSS34nyBxKQ8q5CSTWFF1Fj9vUg== X-Received: by 10.28.170.75 with SMTP id t72mr10772808wme.15.1513590293402; Mon, 18 Dec 2017 01:44:53 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id p13sm12820783wrc.61.2017.12.18.01.44.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Dec 2017 01:44:52 -0800 (PST) From: Jerome Brunet To: Andrew Lunn , Florian Fainelli Subject: [PATCH net-next v3 1/7] net: phy: meson-gxl: check phy_write return value Date: Mon, 18 Dec 2017 10:44:40 +0100 Message-Id: <20171218094446.31912-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171218094446.31912-1-jbrunet@baylibre.com> References: <20171218094446.31912-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171218_014516_180985_2DE88E34 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. 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: Kevin Hilman , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet 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 Always check phy_write return values. Better to be safe than sorry Reviewed-by: Andrew Lunn Signed-off-by: Jerome Brunet --- drivers/net/phy/meson-gxl.c | 50 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c index 4ee630afe43a..900606204c0a 100644 --- a/drivers/net/phy/meson-gxl.c +++ b/drivers/net/phy/meson-gxl.c @@ -26,27 +26,53 @@ static int meson_gxl_config_init(struct phy_device *phydev) { + int ret; + /* Enable Analog and DSP register Bank access by */ - phy_write(phydev, 0x14, 0x0000); - phy_write(phydev, 0x14, 0x0400); - phy_write(phydev, 0x14, 0x0000); - phy_write(phydev, 0x14, 0x0400); + ret = phy_write(phydev, 0x14, 0x0000); + if (ret) + return ret; + ret = phy_write(phydev, 0x14, 0x0400); + if (ret) + return ret; + ret = phy_write(phydev, 0x14, 0x0000); + if (ret) + return ret; + ret = phy_write(phydev, 0x14, 0x0400); + if (ret) + return ret; /* Write Analog register 23 */ - phy_write(phydev, 0x17, 0x8E0D); - phy_write(phydev, 0x14, 0x4417); + ret = phy_write(phydev, 0x17, 0x8E0D); + if (ret) + return ret; + ret = phy_write(phydev, 0x14, 0x4417); + if (ret) + return ret; /* Enable fractional PLL */ - phy_write(phydev, 0x17, 0x0005); - phy_write(phydev, 0x14, 0x5C1B); + ret = phy_write(phydev, 0x17, 0x0005); + if (ret) + return ret; + ret = phy_write(phydev, 0x14, 0x5C1B); + if (ret) + return ret; /* Program fraction FR_PLL_DIV1 */ - phy_write(phydev, 0x17, 0x029A); - phy_write(phydev, 0x14, 0x5C1D); + ret = phy_write(phydev, 0x17, 0x029A); + if (ret) + return ret; + ret = phy_write(phydev, 0x14, 0x5C1D); + if (ret) + return ret; /* Program fraction FR_PLL_DIV1 */ - phy_write(phydev, 0x17, 0xAAAA); - phy_write(phydev, 0x14, 0x5C1C); + ret = phy_write(phydev, 0x17, 0xAAAA); + if (ret) + return ret; + ret = phy_write(phydev, 0x14, 0x5C1C); + if (ret) + return ret; return 0; }