Commit c312c781 authored by Andre Przywara's avatar Andre Przywara Committed by David S. Miller

net: phy: mdio-bcm-unimac: Fix clock handling

The DT binding for this PHY describes an *optional* clock property.
Due to a bug in the error handling logic, we are actually ignoring this
clock *all* of the time so far.

Fix this by using devm_clk_get_optional() to handle this clock properly.

Fixes: b78ac6ec ("net: phy: mdio-bcm-unimac: Allow configuring MDIO clock divider")
Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 50e0d28d
...@@ -242,11 +242,9 @@ static int unimac_mdio_probe(struct platform_device *pdev) ...@@ -242,11 +242,9 @@ static int unimac_mdio_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
priv->clk = devm_clk_get(&pdev->dev, NULL); priv->clk = devm_clk_get_optional(&pdev->dev, NULL);
if (PTR_ERR(priv->clk) == -EPROBE_DEFER) if (IS_ERR(priv->clk))
return PTR_ERR(priv->clk); return PTR_ERR(priv->clk);
else
priv->clk = NULL;
ret = clk_prepare_enable(priv->clk); ret = clk_prepare_enable(priv->clk);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment