|
@@ -1773,7 +1773,9 @@ static int bcm_enet_probe(struct platform_device *pdev)
|
|
ret = PTR_ERR(priv->mac_clk);
|
|
ret = PTR_ERR(priv->mac_clk);
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
- clk_prepare_enable(priv->mac_clk);
|
|
|
|
|
|
+ ret = clk_prepare_enable(priv->mac_clk);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto out_put_clk_mac;
|
|
|
|
|
|
/* initialize default and fetch platform data */
|
|
/* initialize default and fetch platform data */
|
|
priv->rx_ring_size = BCMENET_DEF_RX_DESC;
|
|
priv->rx_ring_size = BCMENET_DEF_RX_DESC;
|
|
@@ -1805,9 +1807,11 @@ static int bcm_enet_probe(struct platform_device *pdev)
|
|
if (IS_ERR(priv->phy_clk)) {
|
|
if (IS_ERR(priv->phy_clk)) {
|
|
ret = PTR_ERR(priv->phy_clk);
|
|
ret = PTR_ERR(priv->phy_clk);
|
|
priv->phy_clk = NULL;
|
|
priv->phy_clk = NULL;
|
|
- goto out_put_clk_mac;
|
|
|
|
|
|
+ goto out_disable_clk_mac;
|
|
}
|
|
}
|
|
- clk_prepare_enable(priv->phy_clk);
|
|
|
|
|
|
+ ret = clk_prepare_enable(priv->phy_clk);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto out_put_clk_phy;
|
|
}
|
|
}
|
|
|
|
|
|
/* do minimal hardware init to be able to probe mii bus */
|
|
/* do minimal hardware init to be able to probe mii bus */
|
|
@@ -1900,13 +1904,16 @@ out_free_mdio:
|
|
out_uninit_hw:
|
|
out_uninit_hw:
|
|
/* turn off mdc clock */
|
|
/* turn off mdc clock */
|
|
enet_writel(priv, 0, ENET_MIISC_REG);
|
|
enet_writel(priv, 0, ENET_MIISC_REG);
|
|
- if (priv->phy_clk) {
|
|
|
|
|
|
+ if (priv->phy_clk)
|
|
clk_disable_unprepare(priv->phy_clk);
|
|
clk_disable_unprepare(priv->phy_clk);
|
|
|
|
+
|
|
|
|
+out_put_clk_phy:
|
|
|
|
+ if (priv->phy_clk)
|
|
clk_put(priv->phy_clk);
|
|
clk_put(priv->phy_clk);
|
|
- }
|
|
|
|
|
|
|
|
-out_put_clk_mac:
|
|
|
|
|
|
+out_disable_clk_mac:
|
|
clk_disable_unprepare(priv->mac_clk);
|
|
clk_disable_unprepare(priv->mac_clk);
|
|
|
|
+out_put_clk_mac:
|
|
clk_put(priv->mac_clk);
|
|
clk_put(priv->mac_clk);
|
|
out:
|
|
out:
|
|
free_netdev(dev);
|
|
free_netdev(dev);
|
|
@@ -2748,7 +2755,9 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
|
|
ret = PTR_ERR(priv->mac_clk);
|
|
ret = PTR_ERR(priv->mac_clk);
|
|
goto out_unmap;
|
|
goto out_unmap;
|
|
}
|
|
}
|
|
- clk_enable(priv->mac_clk);
|
|
|
|
|
|
+ ret = clk_prepare_enable(priv->mac_clk);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto out_put_clk;
|
|
|
|
|
|
priv->rx_chan = 0;
|
|
priv->rx_chan = 0;
|
|
priv->tx_chan = 1;
|
|
priv->tx_chan = 1;
|
|
@@ -2769,7 +2778,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
|
|
|
|
|
|
ret = register_netdev(dev);
|
|
ret = register_netdev(dev);
|
|
if (ret)
|
|
if (ret)
|
|
- goto out_put_clk;
|
|
|
|
|
|
+ goto out_disable_clk;
|
|
|
|
|
|
netif_carrier_off(dev);
|
|
netif_carrier_off(dev);
|
|
platform_set_drvdata(pdev, dev);
|
|
platform_set_drvdata(pdev, dev);
|
|
@@ -2778,6 +2787,9 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
+out_disable_clk:
|
|
|
|
+ clk_disable_unprepare(priv->mac_clk);
|
|
|
|
+
|
|
out_put_clk:
|
|
out_put_clk:
|
|
clk_put(priv->mac_clk);
|
|
clk_put(priv->mac_clk);
|
|
|
|
|
|
@@ -2809,6 +2821,9 @@ static int bcm_enetsw_remove(struct platform_device *pdev)
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
release_mem_region(res->start, resource_size(res));
|
|
release_mem_region(res->start, resource_size(res));
|
|
|
|
|
|
|
|
+ clk_disable_unprepare(priv->mac_clk);
|
|
|
|
+ clk_put(priv->mac_clk);
|
|
|
|
+
|
|
free_netdev(dev);
|
|
free_netdev(dev);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|