@@ -94,13 +94,20 @@ static int virtrng_probe(struct virtio_device *vdev)
int err;
/* We expect a single virtqueue. */
+ err = virtio_request_vqs(vdev, 1);
+ if (err)
+ return err;
+
vq = vdev->config->find_vq(vdev, 0, random_recv_done);
- if (IS_ERR(vq))
+ if (IS_ERR(vq)) {
+ virtio_free_vqs(vdev);
return PTR_ERR(vq);
+ }
err = hwrng_register(&virtio_hwrng);
if (err) {
vdev->config->del_vq(vq);
+ virtio_free_vqs(vdev);
return err;
}
@@ -113,6 +120,7 @@ static void virtrng_remove(struct virtio_device *vdev)
vdev->config->reset(vdev);
hwrng_unregister(&virtio_hwrng);
vdev->config->del_vq(vq);
+ virtio_free_vqs(vdev);
}
static struct virtio_device_id id_table[] = {
Add request_vqs/free_vqs calls to virtio-rng. These will be required for MSI support. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- drivers/char/hw_random/virtio-rng.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)