netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Niklas Cassel <niklas.cassel@axis.com>
To: <davem@davemloft.net>
Cc: <f.fainelli@gmail.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <johan@kernel.org>,
	Niklas Cassel <niklass@axis.com>
Subject: [PATCH] net: phy: micrel: support !CONFIG_HAVE_CLK
Date: Mon, 27 Apr 2015 13:00:50 +0200	[thread overview]
Message-ID: <1430132450-4496-1-git-send-email-niklass@axis.com> (raw)

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@axis.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

             reply	other threads:[~2015-04-27 11:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 11:00 Niklas Cassel [this message]
2015-04-27 11:05 ` [PATCH] net: phy: micrel: support !CONFIG_HAVE_CLK Johan Hovold
2015-04-27 11:08   ` Johan Hovold
2015-04-27 17:40     ` David Miller
2015-04-27 17:59 ` Fabio Estevam
2015-05-04 11:30   ` Niklas Cassel
2015-05-08 14:32     ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430132450-4496-1-git-send-email-niklass@axis.com \
    --to=niklas.cassel@axis.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=niklass@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).