diff options
Diffstat (limited to 'hw/core/qdev.c')
-rw-r--r-- | hw/core/qdev.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index ff81f675da..10bf086a0a 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -373,10 +373,15 @@ void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev, way is somewhat unclean, and best avoided. */ void qdev_init_nofail(DeviceState *dev) { - const char *typename = object_get_typename(OBJECT(dev)); + Error *err = NULL; + + assert(!dev->realized); - if (qdev_init(dev) < 0) { - error_report("Initialization of device %s failed", typename); + object_property_set_bool(OBJECT(dev), true, "realized", &err); + if (err) { + error_report("Initialization of device %s failed: %s", + object_get_typename(OBJECT(dev)), + error_get_pretty(err)); exit(1); } } |