diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index e85a9797542f84937d02a019281dd720143aa513..473c04410e9ebfcc67e1eddebf51c76e955fabd5 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)