This property is wrongly documented as 'optional', although all the
ethernet units need a clock to be enabled in order to access the MDIO
interface. For that reason, this commit makes the property a required
one and fails to probe the device, when a clock is not properly provided.

Signed-off-by: Ezequiel Garcia <ezequiel.gar...@free-electrons.com>
---
 drivers/net/phy/mdio-mvebu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/mdio-mvebu.c b/drivers/net/phy/mdio-mvebu.c
index 3dcf644..b90e281 100644
--- a/drivers/net/phy/mdio-mvebu.c
+++ b/drivers/net/phy/mdio-mvebu.c
@@ -117,8 +117,9 @@ static int mvebu_mdio_probe(struct device_d *dev)
                return -ENOMEM;
 
        priv->clk = clk_get(dev, NULL);
-       if (!IS_ERR(priv->clk))
-               clk_enable(priv->clk);
+       if (IS_ERR(priv->clk))
+               return PTR_ERR(priv->clk);
+       clk_enable(priv->clk);
 
        priv->miibus.dev.device_node = dev->device_node;
        priv->miibus.priv = priv;
@@ -135,8 +136,7 @@ static void mvebu_mdio_remove(struct device_d *dev)
 
        mdiobus_unregister(&priv->miibus);
 
-       if (!IS_ERR(priv->clk))
-               clk_disable(priv->clk);
+       clk_disable(priv->clk);
 }
 
 static struct of_device_id mvebu_mdio_dt_ids[] = {
-- 
2.0.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to