error: Use error_report_err() where appropriate (again)

Same Coccinelle semantic patch as in commit 565f65d.

We now use the original error whole instead of just its message
obtained with error_get_pretty().  This avoids suppressing its hint
(see commit 50b7b00), but I don't think the errors touched in this
commit can come with hints.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1450452927-8346-3-git-send-email-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2015-12-18 16:35:05 +01:00
parent 85b01e0960
commit 4fffeb5e19
8 changed files with 9 additions and 12 deletions

View File

@ -1861,8 +1861,7 @@ static int sd_create(const char *filename, QemuOpts *opts,
fd = connect_to_sdog(s, &local_err);
if (fd < 0) {
error_report("%s", error_get_pretty(local_err));
error_free(local_err);
error_report_err(local_err);
ret = -EIO;
goto out;
}

View File

@ -75,7 +75,7 @@ static void imx25_pdk_init(MachineState *machine)
object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
if (err != NULL) {
error_report("%s", error_get_pretty(err));
error_report_err(err);
exit(1);
}

View File

@ -74,7 +74,7 @@ static void kzm_init(MachineState *machine)
object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
if (err != NULL) {
error_report("%s", error_get_pretty(err));
error_report_err(err);
exit(1);
}

View File

@ -38,7 +38,7 @@ static void netduino2_init(MachineState *machine)
qdev_prop_set_string(dev, "cpu-model", "cortex-m3");
object_property_set_bool(OBJECT(dev), true, "realized", &err);
if (err != NULL) {
error_report("%s", error_get_pretty(err));
error_report_err(err);
exit(1);
}
}

View File

@ -41,7 +41,7 @@ static void xlnx_ep108_init(MachineState *machine)
object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
if (err) {
error_report("%s", error_get_pretty(err));
error_report_err(err);
exit(1);
}

View File

@ -465,8 +465,7 @@ static void realize(DeviceState *d, Error **errp)
object_property_add_alias(root_container, link_name,
drc->owner, child_name, &err);
if (err) {
error_report("%s", error_get_pretty(err));
error_free(err);
error_report_err(err);
object_unref(OBJECT(drc));
}
g_free(child_name);
@ -486,8 +485,7 @@ static void unrealize(DeviceState *d, Error **errp)
snprintf(name, sizeof(name), "%x", drck->get_index(drc));
object_property_del(root_container, name, &err);
if (err) {
error_report("%s", error_get_pretty(err));
error_free(err);
error_report_err(err);
object_unref(OBJECT(drc));
}
}

View File

@ -749,7 +749,7 @@ int main(int argc, char **argv)
exp = nbd_export_new(blk, dev_offset, fd_size, nbdflags, nbd_export_closed,
&local_err);
if (!exp) {
error_report("%s", error_get_pretty(local_err));
error_report_err(local_err);
exit(EXIT_FAILURE);
}

2
vl.c
View File

@ -4553,7 +4553,7 @@ int main(int argc, char **argv, char **envp)
Error *local_err = NULL;
qemu_boot_set(boot_once, &local_err);
if (local_err) {
error_report("%s", error_get_pretty(local_err));
error_report_err(local_err);
exit(1);
}
qemu_register_reset(restore_boot_order, g_strdup(boot_order));