summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-03-10 19:34:55 +0300
committerDavid S. Miller <davem@davemloft.net>2017-03-13 09:35:19 +0300
commitc66f6c3775bed342693feec2925276fd13bb1355 (patch)
tree376462f0b6c203615cc42445076a8fb7d3f3dcf3
parent6c1e5abe0780cecafdc24b64aefc84ce6924dda9 (diff)
downloadlinux-c66f6c3775bed342693feec2925276fd13bb1355.tar.xz
net: stmmac: Disable PTP reference clock on error
If an error occurs while opening the device, make sure to disable the PTP reference clock. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 7c38c9baf238..6060410d2b9e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1754,6 +1754,13 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
return 0;
}
+static void stmmac_hw_teardown(struct net_device *dev)
+{
+ struct stmmac_priv *priv = netdev_priv(dev);
+
+ clk_disable_unprepare(priv->plat->clk_ptp_ref);
+}
+
/**
* stmmac_open - open entry point of the driver
* @dev : pointer to the device structure.
@@ -1863,6 +1870,7 @@ irq_error:
phy_stop(dev->phydev);
del_timer_sync(&priv->txtimer);
+ stmmac_hw_teardown(dev);
init_error:
free_dma_desc_resources(priv);
dma_desc_error: