diff options
Diffstat (limited to 'block/vpc.c')
-rw-r--r-- | block/vpc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/block/vpc.c b/block/vpc.c index 16178e5a90..a9bb04149d 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -1081,7 +1081,7 @@ static int coroutine_fn vpc_co_create_opts(const char *filename, QemuOpts *opts, Error **errp) { BlockdevCreateOptions *create_options = NULL; - QDict *qdict = NULL; + QDict *qdict; QObject *qobj; Visitor *v; BlockDriverState *bs = NULL; @@ -1120,14 +1120,13 @@ static int coroutine_fn vpc_co_create_opts(const char *filename, qdict_put_str(qdict, "file", bs->node_name); qobj = qdict_crumple_for_keyval_qiv(qdict, errp); - qobject_unref(qdict); - qdict = qobject_to(QDict, qobj); - if (qdict == NULL) { + if (!qobj) { ret = -EINVAL; goto fail; } - v = qobject_input_visitor_new_keyval(QOBJECT(qdict)); + v = qobject_input_visitor_new_keyval(qobj); + qobject_unref(qobj); visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err); visit_free(v); |