summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--net/vhost-vdpa.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 6a30a44d2b..74d26a9497 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -1840,9 +1840,8 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
 
     queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
                                                  &has_cvq, errp);
-    if (queue_pairs < 0) {
-        qemu_close(vdpa_device_fd);
-        return queue_pairs;
+    if (queue_pairs <= 0) {
+        goto err;
     }
 
     r = vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);