[PATCH v1 51/59] virtio/vhost.c: remove unneeded labels

Daniel Henrique Barboza posted 59 patches 6 years, 1 month ago
Maintainers: Aurelien Jarno <aurelien@aurel32.net>, Max Reitz <mreitz@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Greg Kurz <groug@kaod.org>, Jason Wang <jasowang@redhat.com>, Corey Minyard <minyard@acm.org>, Aleksandar Markovic <amarkovic@wavecomp.com>, Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, David Hildenbrand <david@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, "Daniel P. Berrangé" <berrange@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Wen Congyang <wencongyang2@huawei.com>, "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, "Richard W.M. Jones" <rjones@redhat.com>, Jeff Cody <codyprime@gmail.com>, Riku Voipio <riku.voipio@iki.fi>, Stefan Weil <sw@weilnetz.de>, Michael Roth <mdroth@linux.vnet.ibm.com>, Richard Henderson <rth@twiddle.net>, Eduardo Habkost <ehabkost@redhat.com>, Yuval Shaia <yuval.shaia.ml@gmail.com>, Fam Zheng <fam@euphon.net>, Xie Changlong <xiechanglong.d@gmail.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Halil Pasic <pasic@linux.ibm.com>, Juan Quintela <quintela@redhat.com>, John Snow <jsnow@redhat.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>, Christian Borntraeger <borntraeger@de.ibm.com>, Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>, "Gonglei (Arei)" <arei.gonglei@huawei.com>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH v1 51/59] virtio/vhost.c: remove unneeded labels
Posted by Daniel Henrique Barboza 6 years, 1 month ago
The label 'err_features' in vhost_dev_set_log(), 'out' in
vhost_device_iotlb_miss() and 'fail' in vhost_dev_enable_notifiers()
can be replaced by 'return' with the appropriate value.

CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/virtio/vhost.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 4da0d5a6c5..7b36839221 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -774,7 +774,7 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
     int r, i, idx;
     r = vhost_dev_set_features(dev, enable_log);
     if (r < 0) {
-        goto err_features;
+        return r;
     }
     for (i = 0; i < dev->nvqs; ++i) {
         idx = dev->vhost_ops->vhost_get_vq_index(dev, dev->vq_index + i);
@@ -792,7 +792,6 @@ err_vq:
                                  dev->log_enabled);
     }
     vhost_dev_set_features(dev, dev->log_enabled);
-err_features:
     return r;
 }
 
@@ -938,7 +937,7 @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, uint64_t iova, int write)
             trace_vhost_iotlb_miss(dev, 3);
             error_report("Fail to lookup the translated address "
                          "%"PRIx64, iotlb.translated_addr);
-            goto out;
+            return ret;
         }
 
         len = MIN(iotlb.addr_mask + 1, len);
@@ -949,13 +948,12 @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, uint64_t iova, int write)
         if (ret) {
             trace_vhost_iotlb_miss(dev, 4);
             error_report("Fail to update device iotlb");
-            goto out;
+            return ret;
         }
     }
 
     trace_vhost_iotlb_miss(dev, 2);
 
-out:
     return ret;
 }
 
@@ -1356,7 +1354,7 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
     r = virtio_device_grab_ioeventfd(vdev);
     if (r < 0) {
         error_report("binding does not support host notifiers");
-        goto fail;
+        return r;
     }
 
     for (i = 0; i < hdev->nvqs; ++i) {
@@ -1380,7 +1378,6 @@ fail_vq:
         virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i);
     }
     virtio_device_release_ioeventfd(vdev);
-fail:
     return r;
 }
 
-- 
2.24.1