migration: pre_save return int
Modify the pre_save method on VMStateDescription to return an int
rather than void so that it potentially can fail.
Changed zillions of devices to make them return 0; the only
case I've made it return non-0 is hw/intc/s390_flic_kvm.c that already
had an error_report/return case.
Note: If you add an error exit in your pre_save you must emit
an error_report to say why.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170925112917.21340-2-dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index f76886f..05da316 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -937,11 +937,13 @@
* final pages of memory (which happens between vm_stop()
* and pre_save()) takes max_downtime.
*/
-static void timebase_pre_save(void *opaque)
+static int timebase_pre_save(void *opaque)
{
PPCTimebase *tb = opaque;
timebase_save(tb);
+
+ return 0;
}
const VMStateDescription vmstate_ppc_timebase = {
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index fa8b969..5ccd785 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -140,7 +140,7 @@
return ret;
}
-static void spapr_tce_table_pre_save(void *opaque)
+static int spapr_tce_table_pre_save(void *opaque)
{
sPAPRTCETable *tcet = SPAPR_TCE_TABLE(opaque);
@@ -149,6 +149,8 @@
trace_spapr_iommu_pre_save(tcet->liobn, tcet->mig_nb_table,
tcet->bus_offset, tcet->page_shift);
+
+ return 0;
}
static uint64_t spapr_tce_get_min_page_size(IOMMUMemoryRegion *iommu)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index cf54160..8c2b6dc 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1844,7 +1844,7 @@
},
};
-static void spapr_pci_pre_save(void *opaque)
+static int spapr_pci_pre_save(void *opaque)
{
sPAPRPHBState *sphb = opaque;
GHashTableIter iter;
@@ -1869,7 +1869,7 @@
sphb->msi_devs = NULL;
sphb->msi_devs_num = g_hash_table_size(sphb->msi);
if (!sphb->msi_devs_num) {
- return;
+ return 0;
}
sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig));
@@ -1878,6 +1878,8 @@
sphb->msi_devs[i].key = *(uint32_t *) key;
sphb->msi_devs[i].value = *(spapr_pci_msi *) value;
}
+
+ return 0;
}
static int spapr_pci_post_load(void *opaque, int version_id)