Use error_fatal to simplify obvious fatal errors (again)

Done with the Coccinelle semantic patch from commit 007b065, plus
manual clean up of dead variables.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1452783732-6581-1-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
master
Markus Armbruster 2016-01-14 16:02:12 +01:00
parent e4a096b1cd
commit 07d04a0219
5 changed files with 5 additions and 30 deletions

View File

@ -65,7 +65,6 @@ static struct arm_boot_info imx25_pdk_binfo;
static void imx25_pdk_init(MachineState *machine)
{
IMX25PDK *s = g_new0(IMX25PDK, 1);
Error *err = NULL;
unsigned int ram_size;
unsigned int alias_offset;
int i;
@ -74,11 +73,7 @@ static void imx25_pdk_init(MachineState *machine)
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
&error_abort);
object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
if (err != NULL) {
error_report_err(err);
exit(1);
}
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
/* We need to initialize our memory */
if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE)) {

View File

@ -64,7 +64,6 @@ static struct arm_boot_info kzm_binfo = {
static void kzm_init(MachineState *machine)
{
IMX31KZM *s = g_new0(IMX31KZM, 1);
Error *err = NULL;
unsigned int ram_size;
unsigned int alias_offset;
unsigned int i;
@ -73,11 +72,7 @@ static void kzm_init(MachineState *machine)
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
&error_abort);
object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
if (err != NULL) {
error_report_err(err);
exit(1);
}
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
/* Check the amount of memory is compatible with the SOC */
if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE)) {

View File

@ -30,18 +30,13 @@
static void netduino2_init(MachineState *machine)
{
DeviceState *dev;
Error *err = NULL;
dev = qdev_create(NULL, TYPE_STM32F205_SOC);
if (machine->kernel_filename) {
qdev_prop_set_string(dev, "kernel-filename", machine->kernel_filename);
}
qdev_prop_set_string(dev, "cpu-model", "cortex-m3");
object_property_set_bool(OBJECT(dev), true, "realized", &err);
if (err != NULL) {
error_report_err(err);
exit(1);
}
object_property_set_bool(OBJECT(dev), true, "realized", &error_fatal);
}
static void netduino2_machine_init(MachineClass *mc)

View File

@ -32,7 +32,6 @@ static void xlnx_ep108_init(MachineState *machine)
{
XlnxEP108 *s = g_new0(XlnxEP108, 1);
int i;
Error *err = NULL;
uint64_t ram_size = machine->ram_size;
/* Create the memory region to pass to the SoC */
@ -58,11 +57,7 @@ static void xlnx_ep108_init(MachineState *machine)
object_property_set_link(OBJECT(&s->soc), OBJECT(&s->ddr_ram),
"ddr-ram", &error_abort);
object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
if (err) {
error_report_err(err);
exit(1);
}
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
for (i = 0; i < XLNX_ZYNQMP_NUM_SPIS; i++) {
SSIBus *spi_bus;

7
vl.c
View File

@ -4555,12 +4555,7 @@ int main(int argc, char **argv, char **envp)
net_check_clients();
if (boot_once) {
Error *local_err = NULL;
qemu_boot_set(boot_once, &local_err);
if (local_err) {
error_report_err(local_err);
exit(1);
}
qemu_boot_set(boot_once, &error_fatal);
qemu_register_reset(restore_boot_order, g_strdup(boot_order));
}