[PATCH 2/6] net: phy: mdio-mvebu: Make the clock property required

Ezequiel Garcia ezequiel.garcia at free-electrons.com
Tue Jul 29 13:44:57 PDT 2014


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.garcia at 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




More information about the barebox mailing list