diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-05-31 11:35:29 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2011-06-14 12:56:49 +0200 |
commit | 290a5c60a3d203a62a09c88083456ed3ad20329f (patch) | |
tree | 27adb8a9278d63a66c6e1df7b38dfd5df63c5d8d /hw/usb-bus.c | |
parent | 290d26d2e7510fbbcb68a765695b5838af60b3f0 (diff) | |
download | qemu-290a5c60a3d203a62a09c88083456ed3ad20329f.zip qemu-290a5c60a3d203a62a09c88083456ed3ad20329f.tar.gz qemu-290a5c60a3d203a62a09c88083456ed3ad20329f.tar.bz2 |
usb-bus: Don't detach non attached devices on device exit
This causes an "Error: tried to detach unattached usb device " to be printed,
this can happen when deleting ie a usb host qdev, which did not
get attached (because a device matching the filter never got plugged in).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-bus.c')
-rw-r--r-- | hw/usb-bus.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/usb-bus.c b/hw/usb-bus.c index 91f2083..480956d 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -84,7 +84,9 @@ static int usb_qdev_exit(DeviceState *qdev) USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev); USBBus *bus = usb_bus_from_device(dev); - usb_device_detach(dev); + if (dev->attached) { + usb_device_detach(dev); + } bus->ops->device_destroy(bus, dev); if (dev->info->handle_destroy) { dev->info->handle_destroy(dev); |