aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio-rng.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index e85a979754..473c04410e 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -113,20 +113,22 @@ static void virtio_rng_save(QEMUFile *f, void *opaque)
static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id)
{
+ VirtIORNG *vrng = opaque;
+ int ret;
+
if (version_id != 1) {
return -EINVAL;
}
- return virtio_load(VIRTIO_DEVICE(opaque), f, version_id);
-}
+ ret = virtio_load(VIRTIO_DEVICE(vrng), f, version_id);
+ if (ret != 0) {
+ return ret;
+ }
-static int virtio_rng_load_device(VirtIODevice *vdev, QEMUFile *f,
- int version_id)
-{
/* We may have an element ready but couldn't process it due to a quota
* limit. Make sure to try again after live migration when the quota may
* have been reset.
*/
- virtio_rng_process(VIRTIO_RNG(vdev));
+ virtio_rng_process(vrng);
return 0;
}
@@ -231,7 +233,6 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data)
vdc->realize = virtio_rng_device_realize;
vdc->unrealize = virtio_rng_device_unrealize;
vdc->get_features = get_features;
- vdc->load = virtio_rng_load_device;
}
static void virtio_rng_initfn(Object *obj)