[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211108141834.19105-1-bage@linutronix.de>
Date: Mon, 8 Nov 2021 15:18:34 +0100
From: bage@...utronix.de
To: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>
Cc: Bastian Germann <bage@...utronix.de>,
Russell King <linux@...linux.org.uk>, davem@...emloft.net,
netdev@...r.kernel.org, b.spranger@...utronix.de
Subject: [PATCH net v2] net: phy: phy_ethtool_ksettings_set: Don't discard phy_start_aneg's return
From: Bastian Germann <bage@...utronix.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@...utronix.de>
---
drivers/net/phy/phy.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index beb2b66da132..59e024891f50 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;
+
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
u8 autoneg = cmd->base.autoneg;
u8 duplex = cmd->base.duplex;
@@ -818,12 +820,13 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
if (phy_is_started(phydev)) {
phydev->state = PHY_UP;
phy_trigger_machine(phydev);
+ ret = 0;
} else {
- _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
Powered by blists - more mailing lists