aboutsummaryrefslogtreecommitdiff
path: root/qdev-monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'qdev-monitor.c')
-rw-r--r--qdev-monitor.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 20cfa7615b..22da107484 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -661,9 +661,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
goto err_del_dev;
}
- if (bus) {
- qdev_set_parent_bus(dev, bus);
- } else if (qdev_hotplug && !qdev_get_machine_hotplug_handler(dev)) {
+ if (!bus && qdev_hotplug && !qdev_get_machine_hotplug_handler(dev)) {
/* No bus, no machine hotplug handler --> device is not hotpluggable */
error_setg(&err, "Device '%s' can not be hotplugged on this machine",
driver);
@@ -678,7 +676,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
}
dev->opts = opts;
- object_property_set_bool(OBJECT(dev), true, "realized", &err);
+ qdev_realize(DEVICE(dev), bus, &err);
if (err != NULL) {
dev->opts = NULL;
goto err_del_dev;