]> git.ipfire.org Git - thirdparty/qemu.git/commit
migration: Remove error variant of vmstate_save_state() function
authorArun Menon <armenon@redhat.com>
Thu, 18 Sep 2025 15:23:41 +0000 (20:53 +0530)
committerPeter Xu <peterx@redhat.com>
Fri, 3 Oct 2025 13:48:02 +0000 (09:48 -0400)
commit6f9fc6f5012344292f7014e079e5225b8988383d
tree80544a867d67a1c701bdd2767ca68d550dc53de1
parent94272d9b45bbf17b8bb143b39fd3060aeef7dc3d
migration: Remove error variant of vmstate_save_state() function

This commit removes the redundant vmstate_save_state_with_err()
function.

Previously, commit 969298f9d7 introduced vmstate_save_state_with_err()
to handle error propagation, while vmstate_save_state() existed for
non-error scenarios.
This is because there were code paths where vmstate_save_state_v()
(called internally by vmstate_save_state) did not explicitly set
errors on failure.

This change unifies error handling by
 - updating vmstate_save_state() to accept an Error **errp argument.
 - vmstate_save_state_v() ensures errors are set directly within the errp
   object, eliminating the need for two separate functions.

All calls to vmstate_save_state_with_err() are replaced with
vmstate_save_state(). This simplifies the API and improves code
maintainability.

vmstate_save_state() that only calls vmstate_save_state_v(),
by inference, also has errors set in errp in case of failure.
The errors are reported using error_report_err().
If we want the function to exit on error, then &error_fatal is
passed.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Arun Menon <armenon@redhat.com>
Tested-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20250918-propagate_tpm_error-v14-24-36f11a6fb9d3@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
15 files changed:
hw/display/virtio-gpu.c
hw/pci/pci.c
hw/s390x/virtio-ccw.c
hw/scsi/spapr_vscsi.c
hw/vfio/pci.c
hw/virtio/virtio-mmio.c
hw/virtio/virtio-pci.c
hw/virtio/virtio.c
include/migration/vmstate.h
migration/cpr.c
migration/savevm.c
migration/vmstate-types.c
migration/vmstate.c
tests/unit/test-vmstate.c
ui/vdagent.c