summaryrefslogtreecommitdiffstats
path: root/hw/usb/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb/bus.c')
-rw-r--r--hw/usb/bus.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 957559b18d..ba27afe9f2 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -704,8 +704,7 @@ USBDevice *usbdevice_create(const char *cmdline)
error_report("Failed to create USB device '%s'", f->name);
return NULL;
}
- usb_realize_and_unref(dev, bus, &err);
- if (err) {
+ if (!usb_realize_and_unref(dev, bus, &err)) {
error_reportf_err(err, "Failed to initialize USB device '%s': ",
f->name);
object_unparent(OBJECT(dev));