aboutsummaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2022-11-21 09:50:49 +0100
committerMarkus Armbruster <armbru@redhat.com>2022-12-14 16:19:35 +0100
commit50707b391ecb35dfdd8c92615bca92b601dc3cf1 (patch)
treee441836dbfa938763b6d788a9c01a201f2bb1f48 /monitor
parent457552fc7d7ff2042e23884ab189ccc216778963 (diff)
downloadqemu-50707b391ecb35dfdd8c92615bca92b601dc3cf1.zip
qemu-50707b391ecb35dfdd8c92615bca92b601dc3cf1.tar.gz
qemu-50707b391ecb35dfdd8c92615bca92b601dc3cf1.tar.bz2
monitor: Use ERRP_GUARD() in monitor_init()
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221121085054.683122-6-armbru@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/monitor.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/monitor/monitor.c b/monitor/monitor.c
index 8694902..7ed7bd5 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -711,8 +711,8 @@ void monitor_init_globals_core(void)
int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
{
+ ERRP_GUARD();
Chardev *chr;
- Error *local_err = NULL;
chr = qemu_chr_find(opts->chardev);
if (chr == NULL) {
@@ -726,7 +726,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
switch (opts->mode) {
case MONITOR_MODE_CONTROL:
- monitor_init_qmp(chr, opts->pretty, &local_err);
+ monitor_init_qmp(chr, opts->pretty, errp);
break;
case MONITOR_MODE_READLINE:
if (!allow_hmp) {
@@ -737,17 +737,13 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)
error_setg(errp, "'pretty' is not compatible with HMP monitors");
return -1;
}
- monitor_init_hmp(chr, true, &local_err);
+ monitor_init_hmp(chr, true, errp);
break;
default:
g_assert_not_reached();
}
- if (local_err) {
- error_propagate(errp, local_err);
- return -1;
- }
- return 0;
+ return *errp ? -1 : 0;
}
int monitor_init_opts(QemuOpts *opts, Error **errp)