]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: stmmac: Disable PTP reference clock on error
authorThierry Reding <treding@nvidia.com>
Fri, 10 Mar 2017 16:34:55 +0000 (17:34 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Mar 2017 06:35:19 +0000 (23:35 -0700)
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>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 7c38c9baf23844d6028bb59dbc0843ec69ee4be4..6060410d2b9e75894fbec0c9f75f1c21ad6dd710 100644 (file)
@@ -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 @@ static int stmmac_open(struct net_device *dev)
                phy_stop(dev->phydev);
 
        del_timer_sync(&priv->txtimer);
+       stmmac_hw_teardown(dev);
 init_error:
        free_dma_desc_resources(priv);
 dma_desc_error: