Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: core: don't power off roothub PHYs if phy_set_mode() fails

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>
Link: https://patch.msgid.link/20260218-usb-phy-poweroff-fix-v1-1-66e6831e860e@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gabor Juhos and committed by
Greg Kroah-Hartman
e293015b 1be3b77d

+1 -7
+1 -7
drivers/usb/core/phy.c
··· 200 200 list_for_each_entry(roothub_entry, head, list) { 201 201 err = phy_set_mode(roothub_entry->phy, mode); 202 202 if (err) 203 - goto err_out; 203 + return err; 204 204 } 205 205 206 206 return 0; 207 - 208 - err_out: 209 - list_for_each_entry_continue_reverse(roothub_entry, head, list) 210 - phy_power_off(roothub_entry->phy); 211 - 212 - return err; 213 207 } 214 208 EXPORT_SYMBOL_GPL(usb_phy_roothub_set_mode); 215 209