From e0728f4b607deb5fe1e30e77b6a03bd02db5a900 Mon Sep 17 00:00:00 2001 From: Xiaoguang Wu Date: Tue, 9 Oct 2018 20:40:19 +0800 Subject: [PATCH] DM USB: xHCI: fix a crash issue when usb device is disconnected This is an issue result from incomplete process logic of commit: "ba68bd4 DM USB: xHCI: fix enumeration error after rebooting". This patch is used to fix it. Signed-off-by: Xiaoguang Wu Reviewed-by: Liang Yang Acked-by: Yu Wang Tracked-On: #1425 --- devicemodel/hw/pci/xhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devicemodel/hw/pci/xhci.c b/devicemodel/hw/pci/xhci.c index c28e08a94..ca311015c 100644 --- a/devicemodel/hw/pci/xhci.c +++ b/devicemodel/hw/pci/xhci.c @@ -704,7 +704,9 @@ pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data) if (xdev->slots[slot] == edev) break; - assert(status == VPORT_EMULATED || status == VPORT_CONNECTED); + assert(VPORT_STATE(status) == VPORT_EMULATED || + VPORT_STATE(status) == VPORT_CONNECTED); + xdev->port_map_tbl[di.bus][di.port] = VPORT_NUM_STATE(VPORT_ASSIGNED, 0);