generic_setup_phy may mask a power on failure due to the return value from generic_phy_exit, typically 0, is being used as return value.
Fix this by ignoring the return value of the generic_phy_exit call, also remove an unnecessary check for -ENOENT. Fixes: 84e561407a5f ("phy: Add generic_{setup,shutdown}_phy() helpers") Signed-off-by: Jonas Karlman <jo...@kwiboo.se> --- drivers/phy/phy-uclass.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index 629ef3aa3de5..afb0e347f76f 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -506,24 +506,22 @@ int generic_phy_power_off_bulk(struct phy_bulk *bulk) int generic_setup_phy(struct udevice *dev, struct phy *phy, int index) { - int ret = 0; + int ret; if (!phy) return 0; ret = generic_phy_get_by_index(dev, index, phy); - if (ret) { - if (ret != -ENOENT) - return ret; - } else { - ret = generic_phy_init(phy); - if (ret) - return ret; + if (ret) + return ret; - ret = generic_phy_power_on(phy); - if (ret) - ret = generic_phy_exit(phy); - } + ret = generic_phy_init(phy); + if (ret) + return ret; + + ret = generic_phy_power_on(phy); + if (ret) + generic_phy_exit(phy); return ret; } -- 2.41.0