summary refs log tree commit diff stats
path: root/monitor/monitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-07-07 18:06:07 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-07-10 15:18:08 +0200
commitb11a093c6025635b4504d79d30daa334a01279a5 (patch)
treeba15ee5016a149a5fc3d302417398cd585754f13 /monitor/monitor.c
parent4bc6d7ee0e95b879b7f4823b6e765cf9bf5845e7 (diff)
downloadfocaccia-qemu-b11a093c6025635b4504d79d30daa334a01279a5.tar.gz
focaccia-qemu-b11a093c6025635b4504d79d30daa334a01279a5.zip
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>
Diffstat (limited to 'monitor/monitor.c')
-rw-r--r--monitor/monitor.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/monitor/monitor.c b/monitor/monitor.c
index 19dcb8fbe3..b385a3d569 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -657,25 +657,18 @@ int monitor_init_opts(QemuOpts *opts, Error **errp)
 {
     Visitor *v;
     MonitorOptions *options;
-    Error *local_err = NULL;
+    int ret;
 
     v = opts_visitor_new(opts);
-    visit_type_MonitorOptions(v, NULL, &options, &local_err);
+    visit_type_MonitorOptions(v, NULL, &options, errp);
     visit_free(v);
-
-    if (local_err) {
-        goto out;
+    if (!options) {
+        return -1;
     }
 
-    monitor_init(options, true, &local_err);
+    ret = monitor_init(options, true, errp);
     qapi_free_MonitorOptions(options);
-
-out:
-    if (local_err) {
-        error_propagate(errp, local_err);
-        return -1;
-    }
-    return 0;
+    return ret;
 }
 
 QemuOptsList qemu_mon_opts = {