Revision 290a5c60 hw/usb-bus.c

b/hw/usb-bus.c
84 84
    USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev);
85 85
    USBBus *bus = usb_bus_from_device(dev);
86 86

  
87
    usb_device_detach(dev);
87
    if (dev->attached) {
88
        usb_device_detach(dev);
89
    }
88 90
    bus->ops->device_destroy(bus, dev);
89 91
    if (dev->info->handle_destroy) {
90 92
        dev->info->handle_destroy(dev);

Also available in: Unified diff