aboutsummaryrefslogtreecommitdiff
path: root/usb-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'usb-linux.c')
-rw-r--r--usb-linux.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usb-linux.c b/usb-linux.c
index 42baafe..9b6f2be 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1178,10 +1178,14 @@ static int usb_host_open(USBHostDevice *dev, int bus_num,
prod_name);
}
+ ret = usb_device_attach(&dev->dev);
+ if (ret) {
+ goto fail;
+ }
+
/* USB devio uses 'write' flag to check for async completions */
qemu_set_fd_handler(dev->fd, NULL, async_complete, dev);
- usb_device_attach(&dev->dev);
return 0;
fail: