From: Gonglei <arei.gong...@huawei.com>

Signed-off-by: Gonglei <arei.gong...@huawei.com>
---
 hw/usb/hcd-musb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c
index 66bc61a..f2cb73c 100644
--- a/hw/usb/hcd-musb.c
+++ b/hw/usb/hcd-musb.c
@@ -624,6 +624,10 @@ static void musb_packet(MUSBState *s, MUSBEndPoint *ep,
 
     /* A wild guess on the FADDR semantics... */
     dev = usb_find_device(&s->port, ep->faddr[idx]);
+    if (!dev) {
+        TRACE("Do not find an usb device");
+        return;
+    }
     uep = usb_ep_get(dev, pid, ep->type[idx] & 0xf);
     usb_packet_setup(&ep->packey[dir].p, pid, uep, 0,
                      (dev->addr << 16) | (uep->nr << 8) | pid, false, true);
-- 
1.7.12.4



Reply via email to