]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: stmmac: Balance PTP reference clock enable/disable
authorThierry Reding <treding@nvidia.com>
Fri, 10 Mar 2017 16:34:56 +0000 (17:34 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Mar 2017 06:35:20 +0000 (23:35 -0700)
clk_prepare_enable() and clk_disable_unprepare() for this clock aren't
properly balanced, which can trigger a WARN_ON() in the common clock
framework.

Reviewed-By: Joao Pinto <jpinto@synopsys.com>
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
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

index 6060410d2b9e75894fbec0c9f75f1c21ad6dd710..ce6d7e791f3ff574796b3e4fef770ce824bf04b8 100644 (file)
@@ -1711,6 +1711,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
        stmmac_mmc_setup(priv);
 
        if (init_ptp) {
+               ret = clk_prepare_enable(priv->plat->clk_ptp_ref);
+               if (ret < 0)
+                       netdev_warn(priv->dev, "failed to enable PTP reference clock: %d\n", ret);
+
                ret = stmmac_init_ptp(priv);
                if (ret == -EOPNOTSUPP)
                        netdev_warn(priv->dev, "PTP not supported by HW\n");
index f2d94eafeb0abeab4bb04eb50925cb3c0ffde2d7..fe49c3105755b1b90b7e18b853eeec1bdedbf1f9 100644 (file)
@@ -365,7 +365,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
                plat->clk_ptp_ref = NULL;
                dev_warn(&pdev->dev, "PTP uses main clock\n");
        } else {
-               clk_prepare_enable(plat->clk_ptp_ref);
                plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref);
                dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
        }