lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1430132450-4496-1-git-send-email-niklass@axis.com>
Date:	Mon, 27 Apr 2015 13:00:50 +0200
From:	Niklas Cassel <niklas.cassel@...s.com>
To:	<davem@...emloft.net>
CC:	<f.fainelli@...il.com>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <johan@...nel.org>,
	Niklas Cassel <niklass@...s.com>
Subject: [PATCH] net: phy: micrel: support !CONFIG_HAVE_CLK

Since NULL is a valid clock, we shouldn't use
IS_ERR_OR_NULL.

Implemented as Russell King suggested in:

http://lkml.kernel.org/r/20150207172949.GE8656@n2100.arm.linux.org.uk

Signed-off-by: Niklas Cassel <niklass@...s.com>
---
 drivers/net/phy/micrel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 1190fd8..d958d13 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -522,6 +522,7 @@ static int kszphy_probe(struct phy_device *phydev)
 	struct device_node *np = phydev->dev.of_node;
 	struct kszphy_priv *priv;
 	struct clk *clk;
+	unsigned long rate = 0;
 	int ret;
 
 	priv = devm_kzalloc(&phydev->dev, sizeof(*priv), GFP_KERNEL);
@@ -548,8 +549,10 @@ static int kszphy_probe(struct phy_device *phydev)
 	}
 
 	clk = devm_clk_get(&phydev->dev, "rmii-ref");
-	if (!IS_ERR(clk)) {
-		unsigned long rate = clk_get_rate(clk);
+	if (!IS_ERR(clk))
+		rate = clk_get_rate(clk);
+
+	if (rate) {
 		bool rmii_ref_clk_sel_25_mhz;
 
 		priv->rmii_ref_clk_sel = type->has_rmii_ref_clk_sel;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ