usb: don't wakeup during coldplug
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 23 May 2017 08:46:35 +0000 (10:46 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 29 May 2017 12:18:09 +0000 (14:18 +0200)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1452512
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170523084635.20062-1-kraxel@redhat.com

hw/usb/core.c

index 45fa00c517177c7566dc2e22faed94a4b528d263..241ae66b15059b2963acc1debbe0e50e674497b6 100644 (file)
@@ -98,6 +98,14 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
     USBDevice *dev = ep->dev;
     USBBus *bus = usb_bus_from_device(dev);
 
+    if (!qdev_hotplug) {
+        /*
+         * This is machine init cold plug.  No need to wakeup anyone,
+         * all devices will be reset anyway.  And trying to wakeup can
+         * cause problems due to hitting uninitialized devices.
+         */
+        return;
+    }
     if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) {
         dev->port->ops->wakeup(dev->port);
     }