summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/vl.c b/vl.c
index 0c2208f723..fd6a5c2ee2 100644
--- a/vl.c
+++ b/vl.c
@@ -2276,11 +2276,14 @@ static int device_help_func(void *opaque, QemuOpts *opts, Error **errp)
static int device_init_func(void *opaque, QemuOpts *opts, Error **errp)
{
+ Error *err = NULL;
DeviceState *dev;
- dev = qdev_device_add(opts);
- if (!dev)
+ dev = qdev_device_add(opts, &err);
+ if (!dev) {
+ error_report_err(err);
return -1;
+ }
object_unref(OBJECT(dev));
return 0;
}