Skip to content

Commit e293015

Browse files
juhosggregkh
authored andcommitted
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: b97a313 ("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>
1 parent 1be3b77 commit e293015

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

drivers/usb/core/phy.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,10 @@ int usb_phy_roothub_set_mode(struct usb_phy_roothub *phy_roothub,
200200
list_for_each_entry(roothub_entry, head, list) {
201201
err = phy_set_mode(roothub_entry->phy, mode);
202202
if (err)
203-
goto err_out;
203+
return err;
204204
}
205205

206206
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;
213207
}
214208
EXPORT_SYMBOL_GPL(usb_phy_roothub_set_mode);
215209

0 commit comments

Comments
 (0)