diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-09-11 15:04:45 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-01-13 11:58:58 +0100 |
commit | 007b06578ab6063d49b6834d95274c37387a1efb (patch) | |
tree | d8218a5a0b7c377079468333483a8d6576ab6192 /hw/i386 | |
parent | 8d780f43921feb7fd8d0b58f779a22d1265f2378 (diff) |
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 'hw/i386')
-rw-r--r-- | hw/i386/pc.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c36b8cf45a..166e8e2112 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -433,7 +433,6 @@ void pc_cmos_init(PCMachineState *pcms, { int val; static pc_cmos_init_late_arg arg; - Error *local_err = NULL; /* various important CMOS locations needed by PC/Bochs bios */ @@ -481,11 +480,7 @@ void pc_cmos_init(PCMachineState *pcms, object_property_set_link(OBJECT(pcms), OBJECT(s), "rtc_state", &error_abort); - set_boot_dev(s, MACHINE(pcms)->boot_order, &local_err); - if (local_err) { - error_report_err(local_err); - exit(1); - } + set_boot_dev(s, MACHINE(pcms)->boot_order, &error_fatal); val = 0; val |= 0x02; /* FPU is there */ @@ -1123,7 +1118,6 @@ void pc_cpus_init(PCMachineState *pcms) int i; X86CPU *cpu = NULL; MachineState *machine = MACHINE(pcms); - Error *error = NULL; unsigned long apic_id_limit; /* init CPUs */ @@ -1144,11 +1138,7 @@ void pc_cpus_init(PCMachineState *pcms) for (i = 0; i < smp_cpus; i++) { cpu = pc_new_cpu(machine->cpu_model, x86_cpu_apic_id_from_index(i), - &error); - if (error) { - error_report_err(error); - exit(1); - } + &error_fatal); object_unref(OBJECT(cpu)); } |