[RFC PATCH 06/15] virtio-iommu: Handle virtio_device_ready() failure

From: Xie Yongji
Date: Mon May 17 2021 - 05:35:21 EST


Now virtio_device_ready() will return error if we get
invalid status. Let's handle this case on probe.

Signed-off-by: Xie Yongji <xieyongji@xxxxxxxxxxxxx>
---
drivers/iommu/virtio-iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 2bfdd5734844..0d4840c5841a 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -1053,7 +1053,9 @@ static int viommu_probe(struct virtio_device *vdev)

viommu_ops.pgsize_bitmap = viommu->pgsize_bitmap;

- virtio_device_ready(vdev);
+ ret = virtio_device_ready(vdev);
+ if (ret)
+ goto err_free_vqs;

/* Populate the event queue with buffers */
ret = viommu_fill_evtq(viommu);
--
2.11.0