]> git.proxmox.com Git - mirror_qemu.git/blobdiff - usb-linux.c
Merge remote-tracking branch 'aneesh/for-upstream-8' into staging
[mirror_qemu.git] / usb-linux.c
index 7d4d1d7bcf9ad8f70239df63fb47eaa00bb6d612..f086d57edbc774b7ed9ff2c5cea698259a46ca55 100644 (file)
@@ -1349,7 +1349,7 @@ static int usb_host_close(USBHostDevice *dev)
 {
     int i;
 
-    if (dev->fd == -1 || !dev->dev.attached) {
+    if (dev->fd == -1) {
         return -1;
     }
 
@@ -1367,7 +1367,9 @@ static int usb_host_close(USBHostDevice *dev)
     }
     async_complete(dev);
     dev->closing = 0;
-    usb_device_detach(&dev->dev);
+    if (dev->dev.attached) {
+        usb_device_detach(&dev->dev);
+    }
     ioctl(dev->fd, USBDEVFS_RESET);
     close(dev->fd);
     dev->fd = -1;