aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb-bus.c')
-rw-r--r--hw/usb-bus.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 8cafb76fff..8203390929 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -77,23 +77,21 @@ static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base)
QLIST_INIT(&dev->strings);
rc = usb_claim_port(dev);
if (rc != 0) {
- goto err;
+ return rc;
}
rc = dev->info->init(dev);
if (rc != 0) {
- goto err;
+ usb_release_port(dev);
+ return rc;
}
if (dev->auto_attach) {
rc = usb_device_attach(dev);
if (rc != 0) {
- goto err;
+ usb_qdev_exit(qdev);
+ return rc;
}
}
return 0;
-
-err:
- usb_qdev_exit(qdev);
- return rc;
}
static int usb_qdev_exit(DeviceState *qdev)