diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-06-10 07:32:44 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-06-15 22:06:04 +0200 |
commit | 464a22c7570d53518da5bd492b70bae1800a6556 (patch) | |
tree | 7b6550aed7d6a84f4f3088c4bb080605b38bf57b /qdev-monitor.c | |
parent | 510ef98dca5c44039b6f77f9752f62b5a9752c00 (diff) |
qdev: Use qdev_realize() in qdev_device_add()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-56-armbru@redhat.com>
Diffstat (limited to 'qdev-monitor.c')
-rw-r--r-- | qdev-monitor.c | 6 |
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; |