From 007b06578ab6063d49b6834d95274c37387a1efb Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 11 Sep 2015 15:04:45 +0200 Subject: 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" Cc: Eduardo Habkost Cc: Paolo Bonzini Signed-off-by: Markus Armbruster Reviewed-by: Eduardo Habkost --- hw/arm/versatilepb.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'hw/arm/versatilepb.c') diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 912c2908f3..70eefe9987 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -192,7 +192,6 @@ static void versatile_init(MachineState *machine, int board_id) int n; int done_smc = 0; DriveInfo *dinfo; - Error *err = NULL; if (!machine->cpu_model) { machine->cpu_model = "arm926"; @@ -211,18 +210,10 @@ static void versatile_init(MachineState *machine, int board_id) * realization. */ if (object_property_find(cpuobj, "has_el3", NULL)) { - object_property_set_bool(cpuobj, false, "has_el3", &err); - if (err) { - error_report_err(err); - exit(1); - } + object_property_set_bool(cpuobj, false, "has_el3", &error_fatal); } - object_property_set_bool(cpuobj, true, "realized", &err); - if (err) { - error_report_err(err); - exit(1); - } + object_property_set_bool(cpuobj, true, "realized", &error_fatal); cpu = ARM_CPU(cpuobj); -- cgit v1.2.3