qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto


From: Laurent Vivier
Subject: Re: [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto
Date: Tue, 2 Aug 2022 14:10:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 02/08/2022 13:24, Eugenio Pérez wrote:
Few steps allocate new resources, and all of the allocated can be
checked to avoid trying to free an invalid one.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
  net/vhost-vdpa.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 303447a68e..ac1810723c 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -588,8 +588,7 @@ 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;
+        goto err;
      }
if (opts->x_svq) {
@@ -604,7 +603,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char 
*name,
          if (invalid_dev_features) {
              error_setg(errp, "vdpa svq does not work with features 0x%" 
PRIx64,
                         invalid_dev_features);
-            goto err_svq;
+            goto err;
          }
vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
@@ -640,7 +639,6 @@ err:
          }
      }
-err_svq:
      qemu_close(vdpa_device_fd);
return -1;

Reviewed-by: Laurent Vivier <lvivier@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]