aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2016-10-12 09:42:04 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-13 11:00:51 -0400
commit7086605a6ab57a5a37eb613cfe214fc62d2bb87b (patch)
tree671b68f023864dcdec2101b586f22a08568cd10a /drivers/net
parentbe9b3174c49109457c490a0ad8976aaeb3df5585 (diff)
stmmac: fix error check when init ptp
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c10
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e838850cc7c3..6c85b61aaa0b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1709,8 +1709,8 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
1709 1709
1710 if (init_ptp) { 1710 if (init_ptp) {
1711 ret = stmmac_init_ptp(priv); 1711 ret = stmmac_init_ptp(priv);
1712 if (ret && ret != -EOPNOTSUPP) 1712 if (ret)
1713 pr_warn("%s: failed PTP initialisation\n", __func__); 1713 netdev_warn(priv->dev, "PTP support cannot init.\n");
1714 } 1714 }
1715 1715
1716#ifdef CONFIG_DEBUG_FS 1716#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 6e3b82972ce8..289d52725a6c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -186,10 +186,12 @@ int stmmac_ptp_register(struct stmmac_priv *priv)
186 priv->device); 186 priv->device);
187 if (IS_ERR(priv->ptp_clock)) { 187 if (IS_ERR(priv->ptp_clock)) {
188 priv->ptp_clock = NULL; 188 priv->ptp_clock = NULL;
189 pr_err("ptp_clock_register() failed on %s\n", priv->dev->name); 189 return PTR_ERR(priv->ptp_clock);
190 } else if (priv->ptp_clock) 190 }
191 pr_debug("Added PTP HW clock successfully on %s\n", 191
192 priv->dev->name); 192 spin_lock_init(&priv->ptp_lock);
193
194 netdev_dbg(priv->dev, "Added PTP HW clock successfully\n");
193 195
194 return 0; 196 return 0;
195} 197}