From: bage@linutronix.de
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Bastian Germann <bage@linutronix.de>,
Russell King <linux@armlinux.org.uk>,
davem@davemloft.net, netdev@vger.kernel.org,
b.spranger@linutronix.de
Subject: [PATCH net v2] net: phy: phy_ethtool_ksettings_set: Don't discard phy_start_aneg's return
Date: Mon, 8 Nov 2021 15:18:34 +0100 [thread overview]
Message-ID: <20211108141834.19105-1-bage@linutronix.de> (raw)
In-Reply-To: <20211105153648.8337-1-bage@linutronix.de>
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>
---
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
next prev parent reply other threads:[~2021-11-08 14:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` bage [this message]
2021-11-08 14:25 ` [PATCH net v2] net: " 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211108141834.19105-1-bage@linutronix.de \
--to=bage@linutronix.de \
--cc=andrew@lunn.ch \
--cc=b.spranger@linutronix.de \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).