]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
stmmac: fix error check when init ptp
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Wed, 12 Oct 2016 13:42:04 +0000 (15:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Oct 2016 15:00:51 +0000 (11:00 -0400)
This patch fixes a problem when propagated the
failure of ptp_clock_register to open function.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre TORGUE <alexandre.torgue@st.com>
Cc: Rayagond Kokatanur <rayagond@vayavyalabs.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c

index e838850cc7c3e7bdf6812ca552e62fa4a9865597..6c85b61aaa0bcd94230cb1766d3558a33808738e 100644 (file)
@@ -1709,8 +1709,8 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 
        if (init_ptp) {
                ret = stmmac_init_ptp(priv);
-               if (ret && ret != -EOPNOTSUPP)
-                       pr_warn("%s: failed PTP initialisation\n", __func__);
+               if (ret)
+                       netdev_warn(priv->dev, "PTP support cannot init.\n");
        }
 
 #ifdef CONFIG_DEBUG_FS
index 6e3b82972ce87e08eea493f4f7a0831e9f080849..289d52725a6c172dc70a6f2db1255afc7161b2cd 100644 (file)
@@ -186,10 +186,12 @@ int stmmac_ptp_register(struct stmmac_priv *priv)
                                             priv->device);
        if (IS_ERR(priv->ptp_clock)) {
                priv->ptp_clock = NULL;
-               pr_err("ptp_clock_register() failed on %s\n", priv->dev->name);
-       } else if (priv->ptp_clock)
-               pr_debug("Added PTP HW clock successfully on %s\n",
-                        priv->dev->name);
+               return PTR_ERR(priv->ptp_clock);
+       }
+
+       spin_lock_init(&priv->ptp_lock);
+
+       netdev_dbg(priv->dev, "Added PTP HW clock successfully\n");
 
        return 0;
 }