Skip to contentSkip to conversation

usb: xhci-dwc3: Call xhci_deregister() before asserting reset

PATCH In review Boon Khai Ng 3 participants 4 messages Feb 24 – Jul 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index 8ad07a4b98c..3504a7cf42c 100644
@@ -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
#2 lore raw

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

#3 lore raw

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