aboutsummaryrefslogtreecommitdiff
path: root/block/qed.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/qed.c')
-rw-r--r--block/qed.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/block/qed.c b/block/qed.c
index 88fa36d..fcec760 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -722,7 +722,7 @@ static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
Error **errp)
{
BlockdevCreateOptions *create_options = NULL;
- QDict *qdict = NULL;
+ QDict *qdict;
QObject *qobj;
Visitor *v;
BlockDriverState *bs = NULL;
@@ -764,14 +764,13 @@ static int coroutine_fn bdrv_qed_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);