Re: [PATCH 01/16] error: Use error_fatal to simplify obvious fatal errors (again)
Philippe Mathieu-Daudé writes: > On 7/20/21 2:53 PM, Markus Armbruster wrote: >> We did this with scripts/coccinelle/use-error_fatal.cocci before, in >> commit 50beeb68094 and 007b06578ab. This commit cleans up rarer >> variations that don't seem worth matching with Coccinelle. >> >> Cc: Thomas Huth >> Cc: Cornelia Huck >> Cc: Peter Xu >> Cc: Juan Quintela >> Cc: Stefan Hajnoczi >> Cc: Paolo Bonzini >> Cc: Marc-André Lureau >> Cc: Gerd Hoffmann >> Cc: Daniel P. Berrangé >> Signed-off-by: Markus Armbruster >> --- >> hw/s390x/ipl.c| 6 +- >> migration/migration.c | 7 +-- >> qemu-img.c| 6 +- >> qemu-io.c | 6 +- >> qemu-nbd.c| 5 + >> scsi/qemu-pr-helper.c | 11 +++ >> softmmu/vl.c | 7 +-- >> target/i386/sev.c | 8 +--- >> ui/console.c | 6 ++ >> ui/spice-core.c | 7 +-- >> 10 files changed, 13 insertions(+), 56 deletions(-) > >> diff --git a/softmmu/vl.c b/softmmu/vl.c >> index 4df1496101..0d2db1abc3 100644 >> --- a/softmmu/vl.c >> +++ b/softmmu/vl.c >> @@ -2673,12 +2673,7 @@ void qmp_x_exit_preconfig(Error **errp) >> qemu_machine_creation_done(); >> >> if (loadvm) { >> -Error *local_err = NULL; >> -if (!load_snapshot(loadvm, NULL, false, NULL, _err)) { >> -error_report_err(local_err); >> -autostart = 0; > > Uh, odd assignment... Yup. Commit 05f2401eb2 "make load_vmstate() return errors" added the assignment: @@ -6030,8 +6030,11 @@ int main(int argc, char **argv, char **envp) exit(1); } -if (loadvm) -load_vmstate(cur_mon, loadvm); +if (loadvm) { +if (load_vmstate(cur_mon, loadvm) < 0) { +autostart = 0; +} +} if (incoming) { qemu_start_incoming_migration(incoming); 827beacb47 "Add a hint message to loadvm and exits on failure" added the exit(1) without deleting the now useless assignment: @@ -4530,6 +4530,7 @@ int main(int argc, char **argv, char **envp) if (load_snapshot(loadvm, _err) < 0) { error_report_err(local_err); autostart = 0; +exit(1); } } >> -exit(1); >> -} >> +load_snapshot(loadvm, NULL, false, NULL, _fatal); >> } >> if (replay_mode != REPLAY_MODE_NONE) { >> replay_vmstate_init(); > > Reviewed-by: Philippe Mathieu-Daudé Thanks!
Re: [PATCH 01/16] error: Use error_fatal to simplify obvious fatal errors (again)
On 7/20/21 2:53 PM, Markus Armbruster wrote: > We did this with scripts/coccinelle/use-error_fatal.cocci before, in > commit 50beeb68094 and 007b06578ab. This commit cleans up rarer > variations that don't seem worth matching with Coccinelle. > > Cc: Thomas Huth > Cc: Cornelia Huck > Cc: Peter Xu > Cc: Juan Quintela > Cc: Stefan Hajnoczi > Cc: Paolo Bonzini > Cc: Marc-André Lureau > Cc: Gerd Hoffmann > Cc: Daniel P. Berrangé > Signed-off-by: Markus Armbruster > --- > hw/s390x/ipl.c| 6 +- > migration/migration.c | 7 +-- > qemu-img.c| 6 +- > qemu-io.c | 6 +- > qemu-nbd.c| 5 + > scsi/qemu-pr-helper.c | 11 +++ > softmmu/vl.c | 7 +-- > target/i386/sev.c | 8 +--- > ui/console.c | 6 ++ > ui/spice-core.c | 7 +-- > 10 files changed, 13 insertions(+), 56 deletions(-) > diff --git a/softmmu/vl.c b/softmmu/vl.c > index 4df1496101..0d2db1abc3 100644 > --- a/softmmu/vl.c > +++ b/softmmu/vl.c > @@ -2673,12 +2673,7 @@ void qmp_x_exit_preconfig(Error **errp) > qemu_machine_creation_done(); > > if (loadvm) { > -Error *local_err = NULL; > -if (!load_snapshot(loadvm, NULL, false, NULL, _err)) { > -error_report_err(local_err); > -autostart = 0; Uh, odd assignment... > -exit(1); > -} > +load_snapshot(loadvm, NULL, false, NULL, _fatal); > } > if (replay_mode != REPLAY_MODE_NONE) { > replay_vmstate_init(); Reviewed-by: Philippe Mathieu-Daudé
Re: [PATCH 01/16] error: Use error_fatal to simplify obvious fatal errors (again)
On Tue, Jul 20, 2021 at 02:53:53PM +0200, Markus Armbruster wrote: > We did this with scripts/coccinelle/use-error_fatal.cocci before, in > commit 50beeb68094 and 007b06578ab. This commit cleans up rarer > variations that don't seem worth matching with Coccinelle. > > Cc: Thomas Huth > Cc: Cornelia Huck > Cc: Peter Xu > Cc: Juan Quintela > Cc: Stefan Hajnoczi > Cc: Paolo Bonzini > Cc: Marc-André Lureau > Cc: Gerd Hoffmann > Cc: Daniel P. Berrangé > Signed-off-by: Markus Armbruster Reviewed-by: Peter Xu -- Peter Xu
Re: [PATCH 01/16] error: Use error_fatal to simplify obvious fatal errors (again)
On Tue, Jul 20, 2021 at 02:53:53PM +0200, Markus Armbruster wrote: > We did this with scripts/coccinelle/use-error_fatal.cocci before, in > commit 50beeb68094 and 007b06578ab. This commit cleans up rarer > variations that don't seem worth matching with Coccinelle. > > Cc: Thomas Huth > Cc: Cornelia Huck > Cc: Peter Xu > Cc: Juan Quintela > Cc: Stefan Hajnoczi > Cc: Paolo Bonzini > Cc: Marc-André Lureau > Cc: Gerd Hoffmann > Cc: Daniel P. Berrangé > Signed-off-by: Markus Armbruster > --- Reviewed-by: Eric Blake I agree with your assessment that this is not bug-fix material needed in 6.1. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org