From: Xiong Weimin <[email protected]>

In vhost_virtqueue_start(), the call to vhost_virtqueue_mask() has a
TODO comment indicating errors are not handled. Add proper error
checking and propagate errors to the caller.

Signed-off-by: Xiong Weimin <[email protected]>
---
 hw/virtio/vhost.c | 10 +++++++--
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 1234567890ab..fedcba098765 4321006
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1467,9 +1467,13 @@ static int vhost_virtqueue_start(struct VirtIODevice 
*vdev,
      * will do it later.
      */
     if (!vdev->use_guest_notifier_mask) {
-        /* TODO: check and handle errors. */
-        vhost_virtqueue_mask(dev, vdev, idx, false);
+        int r = vhost_virtqueue_mask(dev, vdev, idx, false);
+        if (r < 0) {
+            VHOST_OPS_DEBUG(r, "vhost_virtqueue_mask failed");
+            r = -1;
+            goto fail;
+        }
     }
 
     if (k->query_guest_notifiers &&


Reply via email to