[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/35] vhost-vdpa: tweak the error label in vhost_vdpa_add()
From: |
Michael S. Tsirkin |
Subject: |
[PULL 33/35] vhost-vdpa: tweak the error label in vhost_vdpa_add() |
Date: |
Sat, 4 Sep 2021 17:37:34 -0400 |
From: Jason Wang <jasowang@redhat.com>
Introduce new error label to avoid the unnecessary checking of net
pointer.
Fixes: 1e0a84ea49b68 ("vhost-vdpa: introduce vhost-vdpa net client")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20210903091031.47303-10-jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net/vhost-vdpa.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index b43df00a85..99327d17b4 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -99,19 +99,18 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be)
net = vhost_net_init(&options);
if (!net) {
error_report("failed to init vhost_net for queue");
- goto err;
+ goto err_init;
}
s->vhost_net = net;
ret = vhost_vdpa_net_check_device_id(net);
if (ret) {
- goto err;
+ goto err_check;
}
return 0;
-err:
- if (net) {
- vhost_net_cleanup(net);
- g_free(net);
- }
+err_check:
+ vhost_net_cleanup(net);
+ g_free(net);
+err_init:
return -1;
}
--
MST
- [PULL 22/35] hw/virtio: Add flatview update in vhost_user_cleanup(), (continued)
- [PULL 22/35] hw/virtio: Add flatview update in vhost_user_cleanup(), Michael S. Tsirkin, 2021/09/04
- [PULL 23/35] tests/vhost-user-bridge.c: Sanity check socket path length, Michael S. Tsirkin, 2021/09/04
- [PULL 24/35] tests/vhost-user-bridge.c: Fix typo in help message, Michael S. Tsirkin, 2021/09/04
- [PULL 25/35] vhost-vdpa: remove unused variable "acked_features", Michael S. Tsirkin, 2021/09/04
- [PULL 26/35] vhost-vdpa: correctly return err in vhost_vdpa_set_backend_cap(), Michael S. Tsirkin, 2021/09/04
- [PULL 27/35] vhost_net: remove the meaningless assignment in vhost_net_start_one(), Michael S. Tsirkin, 2021/09/04
- [PULL 28/35] vhost: use unsigned int for nvqs, Michael S. Tsirkin, 2021/09/04
- [PULL 29/35] vhost_net: do not assume nvqs is always 2, Michael S. Tsirkin, 2021/09/04
- [PULL 30/35] vhost-vdpa: remove the unnecessary check in vhost_vdpa_add(), Michael S. Tsirkin, 2021/09/04
- [PULL 31/35] vhost-vdpa: don't cleanup twice in vhost_vdpa_add(), Michael S. Tsirkin, 2021/09/04
- [PULL 33/35] vhost-vdpa: tweak the error label in vhost_vdpa_add(),
Michael S. Tsirkin <=
- [PULL 34/35] vhost-vdpa: fix the wrong assertion in vhost_vdpa_init(), Michael S. Tsirkin, 2021/09/04
- [PULL 35/35] vhost-vdpa: remove the unncessary queue_index assignment, Michael S. Tsirkin, 2021/09/04
- [PULL 08/35] vhost-user: add missing space in error message, Michael S. Tsirkin, 2021/09/04
- [PULL 15/35] vhost: correctly detect the enabling IOMMU, Michael S. Tsirkin, 2021/09/04
- [PULL 32/35] vhost-vdpa: fix leaking of vhost_net in vhost_vdpa_add(), Michael S. Tsirkin, 2021/09/04
- Re: [PULL 00/35] pc,pci,virtio: fixes, cleanups, Peter Maydell, 2021/09/06