qdev: fix hotplug when no -device is specified
The peripheral[-anon] containers are initialized lazily but since they sit on
sysbus, they can not be created after realize. This was causing an abort() to
occur during hotplug if no -device option was used.
This was spotted by qemu-test::device-add.sh
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/hw/qdev.c b/hw/qdev.c
index 0465632..d0cf66d 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -1529,3 +1529,9 @@
qdev_property_release_str,
prop, errp);
}
+
+void qdev_machine_init(void)
+{
+ qdev_get_peripheral_anon();
+ qdev_get_peripheral();
+}