net: phy: set PHY_READY after LED setup

phy_probe() sets PHY_READY before calling of_phy_leds(). If LED setup
fails, the error path releases the initialized resources while the PHY
state remains READY even though probing failed.

Set PHY_READY only after LED setup succeeds.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Link: https://patch.msgid.link/20260823035600.188864-4-xuanqiang.luo@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Xuanqiang Luo 2026-08-23 11:55:57 +08:00 committed by Jakub Kicinski
parent f558204abc
commit 52dd7eb1a3

View File

@ -3824,9 +3824,6 @@ static int phy_probe(struct device *dev)
phydev->supported);
}
/* Set the state to READY by default */
phydev->state = PHY_READY;
/* Register the PHY LED triggers */
if (!phydev->is_on_sfp_module)
phy_led_triggers_register(phydev);
@ -3840,6 +3837,9 @@ static int phy_probe(struct device *dev)
goto out_unreg_led_triggers;
}
/* Set the state to READY by default */
phydev->state = PHY_READY;
return 0;
out_unreg_led_triggers: