@@ -33,6 +33,7 @@
#include "qapi/qmp/qjson.h"
#include "monitor/monitor.h"
+static bool devices_realizing;
int qdev_hotplug = 0;
static bool qdev_hot_added = false;
static bool qdev_hot_removed = false;
@@ -354,7 +355,9 @@ void qdev_machine_creation_done(void)
{
Error *err = NULL;
+ devices_realizing = true;
object_child_foreach(qdev_get_machine(), object_realize_one, &err);
+ devices_realizing = false;
if (err != NULL) {
qerror_report_err(err);
error_free(err);
@@ -808,6 +811,8 @@ static void device_initfn(Object *obj)
Property *prop;
Error *err = NULL;
+ assert(!devices_realizing);
+
if (qdev_hotplug) {
dev->hotplugged = 1;
qdev_hot_added = true;
This is safe because current devices are already realized at this point and busses are not devices. Signed-off-by: Andreas Färber <afaerber@suse.de> --- hw/core/qdev.c | 5 +++++ 1 file changed, 5 insertions(+)