lkml.org 
[lkml]   [2015]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net: phy: micrel: support !CONFIG_HAVE_CLK
On Mon, Apr 27, 2015 at 01:00:50PM +0200, Niklas Cassel wrote:
> 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) {

And how do you expect this to work as clk_get_rate returns -EINVAL when
clk is NULL?

Have you not tested your patch?

> bool rmii_ref_clk_sel_25_mhz;
>
> priv->rmii_ref_clk_sel = type->has_rmii_ref_clk_sel;

Johan


\
 
 \ /
  Last update: 2015-04-27 13:41    [W:0.050 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site