* [PATCH] usb: core: don't power off roothub PHYs if phy_set_mode() fails
@ 2026-02-18 20:21 Gabor Juhos
2026-02-20 13:43 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Gabor Juhos @ 2026-02-18 20:21 UTC (permalink / raw)
To: Greg Kroah-Hartman, Miquel Raynal
Cc: linux-usb, linux-kernel, stable, Gabor Juhos
Remove the error path from the usb_phy_roothub_set_mode() function.
The code is clearly wrong, because phy_set_mode() calls can't be
balanced with phy_power_off() calls.
Additionally, the usb_phy_roothub_set_mode() function is called only
from usb_add_hcd() before it powers on the PHYs, so powering off those
makes no sense anyway.
Presumably, the code is copy-pasted from the phy_power_on() function
without adjusting the error handling.
Cc: stable@vger.kernel.org # v5.1+
Fixes: b97a31348379 ("usb: core: comply to PHY framework")
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
drivers/usb/core/phy.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c
index faa20054ad5a1c3f704cb9f70b5049cefdab804e..4bba1c2757406a35bf19eb7984a2807212374d18 100644
--- a/drivers/usb/core/phy.c
+++ b/drivers/usb/core/phy.c
@@ -200,16 +200,10 @@ int usb_phy_roothub_set_mode(struct usb_phy_roothub *phy_roothub,
list_for_each_entry(roothub_entry, head, list) {
err = phy_set_mode(roothub_entry->phy, mode);
if (err)
- goto err_out;
+ return err;
}
return 0;
-
-err_out:
- list_for_each_entry_continue_reverse(roothub_entry, head, list)
- phy_power_off(roothub_entry->phy);
-
- return err;
}
EXPORT_SYMBOL_GPL(usb_phy_roothub_set_mode);
---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260218-usb-phy-poweroff-fix-c354b6ba142c
Best regards,
--
Gabor Juhos <j4g8y7@gmail.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] usb: core: don't power off roothub PHYs if phy_set_mode() fails
2026-02-18 20:21 [PATCH] usb: core: don't power off roothub PHYs if phy_set_mode() fails Gabor Juhos
@ 2026-02-20 13:43 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2026-02-20 13:43 UTC (permalink / raw)
To: Gabor Juhos; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, stable
On 18/02/2026 at 21:21:07 +01, Gabor Juhos <j4g8y7@gmail.com> wrote:
> Remove the error path from the usb_phy_roothub_set_mode() function.
> The code is clearly wrong, because phy_set_mode() calls can't be
> balanced with phy_power_off() calls.
>
> Additionally, the usb_phy_roothub_set_mode() function is called only
> from usb_add_hcd() before it powers on the PHYs, so powering off those
> makes no sense anyway.
>
> Presumably, the code is copy-pasted from the phy_power_on() function
> without adjusting the error handling.
>
> Cc: stable@vger.kernel.org # v5.1+
> Fixes: b97a31348379 ("usb: core: comply to PHY framework")
> Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-20 13:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 20:21 [PATCH] usb: core: don't power off roothub PHYs if phy_set_mode() fails Gabor Juhos
2026-02-20 13:43 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox