From 52aa17cbd800b9e71b67cf7f80c3498183d34ec8 Mon Sep 17 00:00:00 2001 From: Bandan Das Date: Wed, 26 Feb 2014 10:32:40 -0700 Subject: qdev-monitor: set DeviceState opts before calling realize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Setting opts before the realize property is set allows the following patch to make decisions based on whether the user specified "rombar". This also avoids having to create a new tristate property especially for this purpose Reviewed-by: Andreas Färber Signed-off-by: Bandan Das Signed-off-by: Alex Williamson --- qdev-monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'qdev-monitor.c') diff --git a/qdev-monitor.c b/qdev-monitor.c index 3a7dc0d428..6673e3cb61 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -548,16 +548,18 @@ DeviceState *qdev_device_add(QemuOpts *opts) OBJECT(dev), NULL); g_free(name); } + + dev->opts = opts; object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err != NULL) { qerror_report_err(err); error_free(err); + dev->opts = NULL; object_unparent(OBJECT(dev)); object_unref(OBJECT(dev)); qerror_report(QERR_DEVICE_INIT_FAILED, driver); return NULL; } - dev->opts = opts; return dev; } -- cgit v1.2.3