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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index fa07df98a2..d28eff1b5c 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -326,21 +326,21 @@ static USBDevice *usb_try_create_simple(USBBus *bus, const char *name,
Error **errp)
{
Error *err = NULL;
- USBDevice *dev;
+ DeviceState *dev;
- dev = USB_DEVICE(qdev_try_create(&bus->qbus, name));
+ dev = qdev_try_new(name);
if (!dev) {
error_setg(errp, "Failed to create USB device '%s'", name);
return NULL;
}
- object_property_set_bool(OBJECT(dev), true, "realized", &err);
+ qdev_realize_and_unref(dev, &bus->qbus, &err);
if (err) {
error_propagate_prepend(errp, err,
"Failed to initialize USB device '%s': ",
name);
return NULL;
}
- return dev;
+ return USB_DEVICE(dev);
}
USBDevice *usb_create_simple(USBBus *bus, const char *name)