netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: phy_ethtool_ksettings_set: Don't discard phy_start_aneg's return
@ 2021-11-05 15:36 bage
  2021-11-05 18:32 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: bage @ 2021-11-05 15:36 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Bastian Germann, Russell King, davem, netdev, Benedikt Spranger

From: Bastian Germann <bage@linutronix.de>

Take the return of phy_start_aneg into account so that ethtool will handle
negotiation errors and not silently accept invalid input.

Fixes: 2d55173e71b0 ("phy: add generic function to support ksetting support")
Signed-off-by: Bastian Germann <bage@linutronix.de>
Reviewed-by: Benedikt Spranger <b.spranger@linutronix.de>
---
 drivers/net/phy/phy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index a3bfb156c83d..f740b533abba 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -770,6 +770,8 @@ static int phy_poll_aneg_done(struct phy_device *phydev)
 int phy_ethtool_ksettings_set(struct phy_device *phydev,
 			      const struct ethtool_link_ksettings *cmd)
 {
+	int ret = 0;
+
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
 	u8 autoneg = cmd->base.autoneg;
 	u8 duplex = cmd->base.duplex;
@@ -815,10 +817,10 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
 	phydev->mdix_ctrl = cmd->base.eth_tp_mdix_ctrl;
 
 	/* Restart the PHY */
-	_phy_start_aneg(phydev);
+	ret = _phy_start_aneg(phydev);
 
 	mutex_unlock(&phydev->lock);
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL(phy_ethtool_ksettings_set);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-11-10  8:14 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-05 15:36 [PATCH] phy: phy_ethtool_ksettings_set: Don't discard phy_start_aneg's return bage
2021-11-05 18:32 ` Andrew Lunn
2021-11-08 14:21   ` Bastian Germann
2021-11-06 21:52 ` Heiner Kallweit
2021-11-08 14:25   ` Bastian Germann
2021-11-10  8:14     ` Heiner Kallweit
2021-11-08 14:18 ` [PATCH net v2] net: " bage
2021-11-08 14:25   ` Russell King (Oracle)
2021-11-08 15:06     ` Benedikt Spranger
2021-11-08 15:40       ` Russell King (Oracle)
2021-11-08 16:09       ` Andrew Lunn
2021-11-08 16:32         ` Bastian Germann
2021-11-08 17:57           ` Andrew Lunn
2021-11-08 18:01             ` Heiner Kallweit
2021-11-08 18:06               ` Russell King (Oracle)
2021-11-08 19:02               ` Benedikt Spranger
2021-11-08 19:35                 ` Heiner Kallweit
2021-11-09 18:29                 ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).