From: Simon Horman <simon.horman@corigine.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
David Miller <davem@davemloft.net>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Andrew Lunn <andrew@lunn.ch>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Patrick Trantham <patrick.trantham@fuel7.com>
Subject: Re: [PATCH net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
Date: Mon, 13 Mar 2023 14:36:06 +0100 [thread overview]
Message-ID: <ZA8mxgA5Q+CSuDqK@corigine.com> (raw)
In-Reply-To: <026aa4f2-36f5-1c10-ab9f-cdb17dda6ac4@gmail.com>
On Sat, Mar 11, 2023 at 07:34:45PM +0100, Heiner Kallweit wrote:
> If genphy_read_status fails then further access to the PHY may result
> in unpredictable behavior. To prevent this bail out immediately if
> genphy_read_status fails.
>
> Fixes: 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
> ---
> drivers/net/phy/smsc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
> index 9cfaccce1..721871184 100644
> --- a/drivers/net/phy/smsc.c
> +++ b/drivers/net/phy/smsc.c
> @@ -189,8 +189,11 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)
> static int lan87xx_read_status(struct phy_device *phydev)
> {
> struct smsc_phy_priv *priv = phydev->priv;
> + int err;
>
> - int err = genphy_read_status(phydev);
> + err = genphy_read_status(phydev);
> + if (err)
> + return err;
>
> if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) {
> /* Disable EDPD to wake up PHY */
> --
> 2.39.2
next prev parent reply other threads:[~2023-03-13 13:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-11 18:34 [PATCH net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails Heiner Kallweit
2023-03-13 13:36 ` Simon Horman [this message]
2023-03-15 7:20 ` patchwork-bot+netdevbpf
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=ZA8mxgA5Q+CSuDqK@corigine.com \
--to=simon.horman@corigine.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=patrick.trantham@fuel7.com \
/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).