qapi: Smooth another visitor error checking pattern
Convert
visit_type_FOO(v, ..., &ptr, &err);
...
if (err) {
...
}
to
visit_type_FOO(v, ..., &ptr, errp);
...
if (!ptr) {
...
}
for functions that set @ptr to non-null / null on success / error.
Eliminate error_propagate() that are now unnecessary. Delete @err
that are now unused.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-40-armbru@redhat.com>
diff --git a/block/vdi.c b/block/vdi.c
index c4527a9..2496d51 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -906,7 +906,6 @@
uint64_t block_size = DEFAULT_CLUSTER_SIZE;
bool is_static = false;
Visitor *v;
- Error *local_err = NULL;
int ret;
/* Parse options and convert legacy syntax.
@@ -957,11 +956,9 @@
ret = -EINVAL;
goto done;
}
- visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
+ visit_type_BlockdevCreateOptions(v, NULL, &create_options, errp);
visit_free(v);
-
- if (local_err) {
- error_propagate(errp, local_err);
+ if (!create_options) {
ret = -EINVAL;
goto done;
}