usb: xhci-dwc3: Call xhci_deregister() before asserting reset
Subsystems (2)
PATCH 1/1 usb: xhci-dwc3: Call xhci_deregister() before asserting reset
Reorder the remove path to deregister the controller first (and return early on failure), then shut down PHY/clocks and finally assert reset.
This prevents register reads/writes after reset and avoids undefined behavior.
--- drivers/usb/host/xhci-dwc3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-dwc3.c +6 -1
@@ -226,6 +226,11 @@ static int xhci_dwc3_probe(struct udevice *dev)static int xhci_dwc3_remove (struct udevice *dev) {struct xhci_dwc3_plat *plat =dev_get_plat (dev); +int ret; + + ret =xhci_deregister (dev); +if (ret) +return ret;dwc3_shutdown_phy (dev, &plat->phys);
@@ -233,7 +238,7 @@ static int xhci_dwc3_remove(struct udevice *dev)reset_release_bulk (&plat->resets); -return xhci_deregister (dev); +return 0 ; }static const struct udevice_id xhci_dwc3_ids[] = {
Signature · 1 line
2.43.7
Quoted 7 lines · Boon Khai Ng
Reorder the remove path to deregister the controller first (and return early on failure), then shut down PHY/clocks and finally assert reset.
This prevents register reads/writes after reset and avoids undefined behavior.
Signed-off-by Boon Khai Ng <[email protected]>
Hi Marek,
Thanks for the review. Just checking whether this patch is already in your queue and when it might be merged.
Thanks,
Boon Khai
On 7/21/26 4:56 AM, NG, BOON KHAI wrote:
Hello Boon Khai,
Quoted 2 lines
Thanks for the review. Just checking whether this patch is already in your queue and when it might be merged.
The patch slipped through the cracks, I applied it now, thank you for the reminder.
Signature · 2 lines
Best regards, Marek Vasut