aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-09-11 15:04:45 +0200
committerMarkus Armbruster <armbru@redhat.com>2016-01-13 11:58:58 +0100
commit007b06578ab6063d49b6834d95274c37387a1efb (patch)
treed8218a5a0b7c377079468333483a8d6576ab6192 /vl.c
parent8d780f43921feb7fd8d0b58f779a22d1265f2378 (diff)
downloadqemu-007b06578ab6063d49b6834d95274c37387a1efb.zip
qemu-007b06578ab6063d49b6834d95274c37387a1efb.tar.gz
qemu-007b06578ab6063d49b6834d95274c37387a1efb.tar.bz2
Use error_fatal to simplify obvious fatal errors
Done with this Coccinelle semantic patch: @@ type T; identifier FUN, RET; expression list ARGS; expression ERR, EC; @@ ( - T RET = FUN(ARGS, &ERR); + T RET = FUN(ARGS, &error_fatal); | - RET = FUN(ARGS, &ERR); + RET = FUN(ARGS, &error_fatal); | - FUN(ARGS, &ERR); + FUN(ARGS, &error_fatal); ) - if (ERR != NULL) { - error_report_err(ERR); - exit(EC); - } This is actually a more elegant version of my initial semantic patch by courtesy of Eduardo. It leaves dead Error * variables behind, cleaned up manually. Cc: qemu-arm@nongnu.org Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/vl.c b/vl.c
index 5aaea77..6c2add9 100644
--- a/vl.c
+++ b/vl.c
@@ -4329,12 +4329,7 @@ int main(int argc, char **argv, char **envp)
configure_accelerator(current_machine);
if (qtest_chrdev) {
- Error *local_err = NULL;
- qtest_init(qtest_chrdev, qtest_log, &local_err);
- if (local_err) {
- error_report_err(local_err);
- exit(1);
- }
+ qtest_init(qtest_chrdev, qtest_log, &error_fatal);
}
machine_opts = qemu_get_machine_opts();
@@ -4345,24 +4340,14 @@ int main(int argc, char **argv, char **envp)
opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
if (opts) {
- Error *local_err = NULL;
-
boot_order = qemu_opt_get(opts, "order");
if (boot_order) {
- validate_bootdevices(boot_order, &local_err);
- if (local_err) {
- error_report_err(local_err);
- exit(1);
- }
+ validate_bootdevices(boot_order, &error_fatal);
}
boot_once = qemu_opt_get(opts, "once");
if (boot_once) {
- validate_bootdevices(boot_once, &local_err);
- if (local_err) {
- error_report_err(local_err);
- exit(1);
- }
+ validate_bootdevices(boot_once, &error_fatal);
}
boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu);