From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Donggeun Yoo <donggeunyoo.kernel@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alvaro Gamez Machado <alvaro.gamez@hazent.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: phy: dp83848: check phy_read() return value in config_init()
Date: Wed, 2 Sep 2026 10:10:06 +0200 [thread overview]
Message-ID: <b609cf54-2e37-4c43-80c9-ae3d013cc4a8@bootlin.com> (raw)
In-Reply-To: <20260902065828.1031113-1-donggeunyoo.kernel@gmail.com>
Hi,
On 9/2/26 08:58, Donggeun Yoo wrote:
> dp83848_config_init() reads BMCR to detect whether auto-negotiation is
> enabled, but does not check the phy_read() return value. On an MDIO read
> failure phy_read() returns a negative errno, which is then used directly
> in a bitwise test; the auto-negotiation state is left undefined while
> config_init() still reports success.
>
> Check the return value and propagate the error.
>
> Fixes: b718e8c8f4f5 ("net: phy: dp83822: use BMCR_ANENABLE instead of BMSR_ANEGCAPABLE for DP83620")
> Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
> ---
> Only compile-tested; I do not have DP83848-family hardware.
>
> drivers/net/phy/dp83848.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/phy/dp83848.c b/drivers/net/phy/dp83848.c
> index d88b1999d596..e65651ac567a 100644
> --- a/drivers/net/phy/dp83848.c
> +++ b/drivers/net/phy/dp83848.c
> @@ -117,6 +117,9 @@ static int dp83848_config_init(struct phy_device *phydev)
> * we check initial value of BMCR Auto negotiation enable bit
> */
> val = phy_read(phydev, MII_BMCR);
> + if (val < 0)
> + return val;
> +
> if (!(val & BMCR_ANENABLE))
> phydev->autoneg = AUTONEG_DISABLE;
>
>
> base-commit: 70f3995830d3f1e79faa14eb0605914f778feca9
next prev parent reply other threads:[~2026-09-02 8:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 6:58 [PATCH net] net: phy: dp83848: check phy_read() return value in config_init() Donggeun Yoo
2026-09-02 8:10 ` Maxime Chevallier [this message]
2026-09-02 8:18 ` Xuanqiang Luo
2026-09-04 0:50 ` 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=b609cf54-2e37-4c43-80c9-ae3d013cc4a8@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=alvaro.gamez@hazent.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=donggeunyoo.kernel@gmail.com \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.