[Qemu-devel] [PATCH] usb: don't wakeup during coldplug

Gerd Hoffmann posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170523084635.20062-1-kraxel@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
hw/usb/core.c | 8 ++++++++
1 file changed, 8 insertions(+)
[Qemu-devel] [PATCH] usb: don't wakeup during coldplug
Posted by Gerd Hoffmann 6 years, 11 months ago
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1452512
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 45fa00c517..241ae66b15 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -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);
     }
-- 
2.9.3