Skip to contentSkip to conversation

xhci: xhci debugfs device nodes weren't removed after device plugged out

PATCH New Mathias Nyman 1 participant 1 message Feb 12, 2018

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

PATCH 5/6 xhci: xhci debugfs device nodes weren't removed after device plugged out

From: Zhengjun Xing <[email protected]>

There is a bug after plugged out USB device, the device and its ep00 nodes are still kept, we need to remove the nodes in xhci_free_dev when USB device is plugged out.

Fixes 052f71e25a7e ("xhci: Fix xhci debugfs NULL pointer dereference in resume from hibernate")
Cc <[email protected]> # v4.15
---
 drivers/usb/host/xhci.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/host/xhci.c +2 -4
index b01bd64..4adb6da 100644
@@ -3545,12 +3545,10 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
 		virt_dev->eps[i].ep_state &= ~EP_STOP_CMD_PENDING;
 		del_timer_sync(&virt_dev->eps[i].stop_cmd_timer);
 	}
-
+	xhci_debugfs_remove_slot(xhci, udev->slot_id);
 	ret = xhci_disable_slot(xhci, udev->slot_id);
-	if (ret) {
-		xhci_debugfs_remove_slot(xhci, udev->slot_id);
+	if (ret)
 		xhci_free_virt_device(xhci, udev->slot_id);
-	}
 }
 
 int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
Signature · 1 line
2.7.4