[PATCH v2 2/3] phy: Return success from generic_setup_phy() when phy is not found
Jonas Karlman
jonas at kwiboo.se
Fri Sep 1 01:07:10 CEST 2023
Restore the old behavior of ehci_setup_phy() and ohci_setup_phy() to
return success when generic_phy_get_by_index() return -ENOENT.
Fixes: 84e561407a5f ("phy: Add generic_{setup,shutdown}_phy() helpers")
Fixes: 10005004db73 ("usb: ohci: Make usage of generic_{setup,shutdown}_phy() helpers")
Fixes: 083f8aa978a8 ("usb: ehci: Make usage of generic_{setup,shutdown}_phy() helpers")
Fixes: 75341e9c16aa ("usb: ehci: Remove unused ehci_{setup,shutdown}_phy() helpers")
Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
---
v2:
- New patch to fix regression introduced in v2023.01-rc1
drivers/phy/phy-uclass.c | 4 ++--
test/dm/phy.c | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
index d745e7babc12..343c23cead0c 100644
--- a/drivers/phy/phy-uclass.c
+++ b/drivers/phy/phy-uclass.c
@@ -517,8 +517,8 @@ int generic_setup_phy(struct udevice *dev, struct phy *phy, int index)
ret = generic_phy_get_by_index(dev, index, phy);
if (ret) {
- if (ret != -ENOENT)
- return ret;
+ if (ret == -ENOENT)
+ return 0;
} else {
ret = generic_phy_init(phy);
if (ret)
diff --git a/test/dm/phy.c b/test/dm/phy.c
index 4da4841f40f7..4f91abca3a02 100644
--- a/test/dm/phy.c
+++ b/test/dm/phy.c
@@ -255,6 +255,11 @@ static int dm_test_phy_setup(struct unit_test_state *uts)
ut_asserteq(-EIO, generic_setup_phy(parent, &phy, 2));
ut_assertok(generic_shutdown_phy(&phy));
+ /* generic_phy_get_by_index fail with -ENOENT */
+ ut_asserteq(-ENOENT, generic_phy_get_by_index(parent, 3, &phy));
+ ut_assertok(generic_setup_phy(parent, &phy, 3));
+ ut_assertok(generic_shutdown_phy(&phy));
+
return 0;
}
DM_TEST(dm_test_phy_setup, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
--
2.42.0
More information about the U-Boot
mailing list