error: Use error_fatal to simplify obvious fatal errors (again)
We did this with scripts/coccinelle/use-error_fatal.cocci before, in commit50beeb6809
and007b06578a
. This commit cleans up rarer variations that don't seem worth matching with Coccinelle. Cc: Thomas Huth <thuth@redhat.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Peter Xu <peterx@redhat.com> Cc: Juan Quintela <quintela@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210720125408.387910-2-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
c83fcfaf8a
commit
f9734d5d40
|
@ -711,7 +711,6 @@ int s390_ipl_pv_unpack(void)
|
||||||
void s390_ipl_prepare_cpu(S390CPU *cpu)
|
void s390_ipl_prepare_cpu(S390CPU *cpu)
|
||||||
{
|
{
|
||||||
S390IPLState *ipl = get_ipl_device();
|
S390IPLState *ipl = get_ipl_device();
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
cpu->env.psw.addr = ipl->start_addr;
|
cpu->env.psw.addr = ipl->start_addr;
|
||||||
cpu->env.psw.mask = IPL_PSW_MASK;
|
cpu->env.psw.mask = IPL_PSW_MASK;
|
||||||
|
@ -723,10 +722,7 @@ void s390_ipl_prepare_cpu(S390CPU *cpu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ipl->netboot) {
|
if (ipl->netboot) {
|
||||||
if (load_netboot_image(&err) < 0) {
|
load_netboot_image(&error_fatal);
|
||||||
error_report_err(err);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
ipl->qipl.netboot_start_addr = cpu_to_be64(ipl->start_addr);
|
ipl->qipl.netboot_start_addr = cpu_to_be64(ipl->start_addr);
|
||||||
}
|
}
|
||||||
s390_ipl_set_boot_menu(ipl);
|
s390_ipl_set_boot_menu(ipl);
|
||||||
|
|
|
@ -188,8 +188,6 @@ static gint page_request_addr_cmp(gconstpointer ap, gconstpointer bp)
|
||||||
|
|
||||||
void migration_object_init(void)
|
void migration_object_init(void)
|
||||||
{
|
{
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
/* This can only be called once. */
|
/* This can only be called once. */
|
||||||
assert(!current_migration);
|
assert(!current_migration);
|
||||||
current_migration = MIGRATION_OBJ(object_new(TYPE_MIGRATION));
|
current_migration = MIGRATION_OBJ(object_new(TYPE_MIGRATION));
|
||||||
|
@ -210,10 +208,7 @@ void migration_object_init(void)
|
||||||
qemu_mutex_init(¤t_incoming->page_request_mutex);
|
qemu_mutex_init(¤t_incoming->page_request_mutex);
|
||||||
current_incoming->page_requested = g_tree_new(page_request_addr_cmp);
|
current_incoming->page_requested = g_tree_new(page_request_addr_cmp);
|
||||||
|
|
||||||
if (!migration_object_check(current_migration, &err)) {
|
migration_object_check(current_migration, &error_fatal);
|
||||||
error_report_err(err);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
blk_mig_init();
|
blk_mig_init();
|
||||||
ram_mig_init();
|
ram_mig_init();
|
||||||
|
|
|
@ -5350,7 +5350,6 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const img_cmd_t *cmd;
|
const img_cmd_t *cmd;
|
||||||
const char *cmdname;
|
const char *cmdname;
|
||||||
Error *local_error = NULL;
|
|
||||||
int c;
|
int c;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, 0, 'h'},
|
||||||
|
@ -5368,10 +5367,7 @@ int main(int argc, char **argv)
|
||||||
module_call_init(MODULE_INIT_TRACE);
|
module_call_init(MODULE_INIT_TRACE);
|
||||||
qemu_init_exec_dir(argv[0]);
|
qemu_init_exec_dir(argv[0]);
|
||||||
|
|
||||||
if (qemu_init_main_loop(&local_error)) {
|
qemu_init_main_loop(&error_fatal);
|
||||||
error_report_err(local_error);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
qcrypto_init(&error_fatal);
|
qcrypto_init(&error_fatal);
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,6 @@ int main(int argc, char **argv)
|
||||||
int flags = BDRV_O_UNMAP;
|
int flags = BDRV_O_UNMAP;
|
||||||
int ret;
|
int ret;
|
||||||
bool writethrough = true;
|
bool writethrough = true;
|
||||||
Error *local_error = NULL;
|
|
||||||
QDict *opts = NULL;
|
QDict *opts = NULL;
|
||||||
const char *format = NULL;
|
const char *format = NULL;
|
||||||
bool force_share = false;
|
bool force_share = false;
|
||||||
|
@ -629,10 +628,7 @@ int main(int argc, char **argv)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemu_init_main_loop(&local_error)) {
|
qemu_init_main_loop(&error_fatal);
|
||||||
error_report_err(local_error);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!trace_init_backends()) {
|
if (!trace_init_backends()) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -963,10 +963,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemu_init_main_loop(&local_err)) {
|
qemu_init_main_loop(&error_fatal);
|
||||||
error_report_err(local_err);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
bdrv_init();
|
bdrv_init();
|
||||||
atexit(qemu_nbd_shutdown);
|
atexit(qemu_nbd_shutdown);
|
||||||
|
|
||||||
|
|
|
@ -1044,10 +1044,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemu_init_main_loop(&local_err)) {
|
qemu_init_main_loop(&error_fatal);
|
||||||
error_report_err(local_err);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
server_watch = qio_channel_add_watch(QIO_CHANNEL(server_ioc),
|
server_watch = qio_channel_add_watch(QIO_CHANNEL(server_ioc),
|
||||||
G_IO_IN,
|
G_IO_IN,
|
||||||
|
@ -1061,10 +1058,8 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((daemonize || pidfile_specified) &&
|
if (daemonize || pidfile_specified) {
|
||||||
!qemu_write_pidfile(pidfile, &local_err)) {
|
qemu_write_pidfile(pidfile, &error_fatal);
|
||||||
error_report_err(local_err);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_LIBCAP_NG
|
#ifdef CONFIG_LIBCAP_NG
|
||||||
|
|
|
@ -2694,12 +2694,7 @@ void qmp_x_exit_preconfig(Error **errp)
|
||||||
qemu_machine_creation_done();
|
qemu_machine_creation_done();
|
||||||
|
|
||||||
if (loadvm) {
|
if (loadvm) {
|
||||||
Error *local_err = NULL;
|
load_snapshot(loadvm, NULL, false, NULL, &error_fatal);
|
||||||
if (!load_snapshot(loadvm, NULL, false, NULL, &local_err)) {
|
|
||||||
error_report_err(local_err);
|
|
||||||
autostart = 0;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (replay_mode != REPLAY_MODE_NONE) {
|
if (replay_mode != REPLAY_MODE_NONE) {
|
||||||
replay_vmstate_init();
|
replay_vmstate_init();
|
||||||
|
|
|
@ -737,7 +737,6 @@ static void
|
||||||
sev_launch_finish(SevGuestState *sev)
|
sev_launch_finish(SevGuestState *sev)
|
||||||
{
|
{
|
||||||
int ret, error;
|
int ret, error;
|
||||||
Error *local_err = NULL;
|
|
||||||
|
|
||||||
trace_kvm_sev_launch_finish();
|
trace_kvm_sev_launch_finish();
|
||||||
ret = sev_ioctl(sev->sev_fd, KVM_SEV_LAUNCH_FINISH, 0, &error);
|
ret = sev_ioctl(sev->sev_fd, KVM_SEV_LAUNCH_FINISH, 0, &error);
|
||||||
|
@ -752,12 +751,7 @@ sev_launch_finish(SevGuestState *sev)
|
||||||
/* add migration blocker */
|
/* add migration blocker */
|
||||||
error_setg(&sev_mig_blocker,
|
error_setg(&sev_mig_blocker,
|
||||||
"SEV: Migration is not implemented");
|
"SEV: Migration is not implemented");
|
||||||
ret = migrate_add_blocker(sev_mig_blocker, &local_err);
|
migrate_add_blocker(sev_mig_blocker, &error_fatal);
|
||||||
if (local_err) {
|
|
||||||
error_report_err(local_err);
|
|
||||||
error_free(sev_mig_blocker);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1508,7 +1508,6 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
|
||||||
"This VM has no graphic display device.";
|
"This VM has no graphic display device.";
|
||||||
static DisplaySurface *dummy;
|
static DisplaySurface *dummy;
|
||||||
QemuConsole *con;
|
QemuConsole *con;
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
assert(!dcl->ds);
|
assert(!dcl->ds);
|
||||||
|
|
||||||
|
@ -1523,9 +1522,8 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
|
||||||
dcl->con->gl = dcl;
|
dcl->con->gl = dcl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dcl->con && !dpy_compatible_with(dcl->con, dcl, &err)) {
|
if (dcl->con) {
|
||||||
error_report_err(err);
|
dpy_compatible_with(dcl->con, dcl, &error_fatal);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_displaychangelistener_register(dcl, dcl->ops->dpy_name);
|
trace_displaychangelistener_register(dcl, dcl->ops->dpy_name);
|
||||||
|
|
|
@ -671,18 +671,13 @@ static void qemu_spice_init(void)
|
||||||
}
|
}
|
||||||
passwordSecret = qemu_opt_get(opts, "password-secret");
|
passwordSecret = qemu_opt_get(opts, "password-secret");
|
||||||
if (passwordSecret) {
|
if (passwordSecret) {
|
||||||
Error *local_err = NULL;
|
|
||||||
if (qemu_opt_get(opts, "password")) {
|
if (qemu_opt_get(opts, "password")) {
|
||||||
error_report("'password' option is mutually exclusive with "
|
error_report("'password' option is mutually exclusive with "
|
||||||
"'password-secret'");
|
"'password-secret'");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
password = qcrypto_secret_lookup_as_utf8(passwordSecret,
|
password = qcrypto_secret_lookup_as_utf8(passwordSecret,
|
||||||
&local_err);
|
&error_fatal);
|
||||||
if (!password) {
|
|
||||||
error_report_err(local_err);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
str = qemu_opt_get(opts, "password");
|
str = qemu_opt_get(opts, "password");
|
||||||
if (str) {
|
if (str) {
|
||||||
|
|
Loading…
Reference in New Issue