mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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 <donggeunyoo.kernel@gmail.com> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn> Link: https://patch.msgid.link/20260902065828.1031113-1-donggeunyoo.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
e84b89f17a
commit
8c9190bfd1
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user