vl: Clean up error reporting in chardev_init_func()
Calling error_report() in a function that takes an Error ** argument is suspicious. chardev_init_func() does that, and then fails without setting an error. Its caller main(), via qemu_opts_foreach(), is fine with it, but clean it up anyway. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20181017082702.5581-21-armbru@redhat.com>
This commit is contained in:
parent
7e1e0c1112
commit
dd4af97733
8
vl.c
8
vl.c
@ -2239,7 +2239,7 @@ static int chardev_init_func(void *opaque, QemuOpts *opts, Error **errp)
|
|||||||
|
|
||||||
if (!qemu_chr_new_from_opts(opts, &local_err)) {
|
if (!qemu_chr_new_from_opts(opts, &local_err)) {
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_report_err(local_err);
|
error_propagate(errp, local_err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -4233,10 +4233,8 @@ int main(int argc, char **argv, char **envp)
|
|||||||
user_creatable_add_opts_foreach,
|
user_creatable_add_opts_foreach,
|
||||||
object_create_initial, &error_fatal);
|
object_create_initial, &error_fatal);
|
||||||
|
|
||||||
if (qemu_opts_foreach(qemu_find_opts("chardev"),
|
qemu_opts_foreach(qemu_find_opts("chardev"),
|
||||||
chardev_init_func, NULL, NULL)) {
|
chardev_init_func, NULL, &error_fatal);
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_VIRTFS
|
#ifdef CONFIG_VIRTFS
|
||||||
if (qemu_opts_foreach(qemu_find_opts("fsdev"),
|
if (qemu_opts_foreach(qemu_find_opts("fsdev"),
|
||||||
|
Loading…
Reference in New Issue
Block a user