From patchwork Mon Apr 27 11:00:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 464937 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 18D4F1402B6 for ; Mon, 27 Apr 2015 21:01:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932620AbbD0LBQ (ORCPT ); Mon, 27 Apr 2015 07:01:16 -0400 Received: from bastet.se.axis.com ([195.60.68.11]:44721 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751384AbbD0LBO (ORCPT ); Mon, 27 Apr 2015 07:01:14 -0400 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id 2C0D11809B; Mon, 27 Apr 2015 13:01:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id 0MyBSpbaoV6I; Mon, 27 Apr 2015 13:01:12 +0200 (CEST) Received: from boulder.se.axis.com (boulder.se.axis.com [10.0.2.104]) by bastet.se.axis.com (Postfix) with ESMTP id 6EDBF18070; Mon, 27 Apr 2015 13:01:12 +0200 (CEST) Received: from boulder.se.axis.com (localhost [127.0.0.1]) by postfix.imss71 (Postfix) with ESMTP id 3AAFE15B0; Mon, 27 Apr 2015 13:01:12 +0200 (CEST) Received: from thoth.se.axis.com (thoth.se.axis.com [10.0.2.173]) by boulder.se.axis.com (Postfix) with ESMTP id 2D2511530; Mon, 27 Apr 2015 13:01:12 +0200 (CEST) Received: from xmail2.se.axis.com (xmail2.se.axis.com [10.0.5.74]) by thoth.se.axis.com (Postfix) with ESMTP id 2A85034005; Mon, 27 Apr 2015 13:01:12 +0200 (CEST) Received: from lnxniklass.se.axis.com (10.94.49.1) by xmail2.se.axis.com (10.0.5.74) with Microsoft SMTP Server (TLS) id 8.3.342.0; Mon, 27 Apr 2015 13:01:12 +0200 From: Niklas Cassel To: CC: , , , , Niklas Cassel Subject: [PATCH] net: phy: micrel: support !CONFIG_HAVE_CLK Date: Mon, 27 Apr 2015 13:00:50 +0200 Message-ID: <1430132450-4496-1-git-send-email-niklass@axis.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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;