Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
hw/vfio/pci.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 8b8bc5a421..152015d2f7 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2821,8 +2821,8 @@ static int vfio_pci_save_config(VFIODevice *vbasedev, QEMUFile *f, Error **errp)
{
VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
- return vmstate_save_state(f, &vmstate_vfio_pci_config, vdev, NULL,
- errp);
+ return vmstate_save_vmsd(
+ f, &vmstate_vfio_pci_config, vdev, NULL, errp) ? 0 : -EINVAL;
}
static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f)
@@ -2830,18 +2830,16 @@ static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f)
VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
PCIDevice *pdev = PCI_DEVICE(vdev);
pcibus_t old_addr[PCI_NUM_REGIONS - 1];
- int bar, ret;
+ int bar;
Error *local_err = NULL;
for (bar = 0; bar < PCI_ROM_SLOT; bar++) {
old_addr[bar] = pdev->io_regions[bar].addr;
}
- ret = vmstate_load_state(f, &vmstate_vfio_pci_config, vdev, 1,
- &local_err);
- if (ret) {
+ if (!vmstate_load_vmsd(f, &vmstate_vfio_pci_config, vdev, 1, &local_err)) {
error_report_err(local_err);
- return ret;
+ return -EINVAL;
}
vfio_pci_write_config(pdev, PCI_COMMAND,
@@ -2865,7 +2863,7 @@ static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f)
vfio_msix_enable(vdev);
}
- return ret;
+ return 0;
}
/* Transform from VFIODevice to VFIOPCIDevice. Return NULL if fails. */
--
2.48.1