From 8c9190bfd18a2548dea677faed7d6ee11f3cb0c8 Mon Sep 17 00:00:00 2001 From: Donggeun Yoo Date: Wed, 2 Sep 2026 15:58:27 +0900 Subject: [PATCH] net: phy: dp83848: check phy_read() return value in config_init() 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. Cc: stable+noautosel@kernel.org # untested fix to unlikely driver error path Signed-off-by: Donggeun Yoo Reviewed-by: Maxime Chevallier Reviewed-by: Xuanqiang Luo Link: https://patch.msgid.link/20260902065828.1031113-1-donggeunyoo.kernel@gmail.com Signed-off-by: Jakub Kicinski --- 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;