'out' label can be replaced by 'return' with the right return value. Since the 'rc' var was being used just to set -ENOMEM in a single error condition, get rid of the var and set the return value directly in the 'return' call.
CC: Yuval Shaia <yuval.sh...@oracle.com> CC: Marcel Apfelbaum <marcel.apfelb...@gmail.com> Signed-off-by: Daniel Henrique Barboza <danielhb...@gmail.com> --- hw/rdma/vmw/pvrdma_dev_ring.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/rdma/vmw/pvrdma_dev_ring.c b/hw/rdma/vmw/pvrdma_dev_ring.c index d7bc7f5ccc..c2ecce3b41 100644 --- a/hw/rdma/vmw/pvrdma_dev_ring.c +++ b/hw/rdma/vmw/pvrdma_dev_ring.c @@ -28,7 +28,6 @@ int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev, size_t elem_sz, dma_addr_t *tbl, uint32_t npages) { int i; - int rc = 0; strncpy(ring->name, name, MAX_RING_NAME_SZ); ring->name[MAX_RING_NAME_SZ - 1] = 0; @@ -51,14 +50,13 @@ int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev, ring->pages[i] = rdma_pci_dma_map(dev, tbl[i], TARGET_PAGE_SIZE); if (!ring->pages[i]) { - rc = -ENOMEM; rdma_error_report("Failed to map to page %d in ring %s", i, name); goto out_free; } memset(ring->pages[i], 0, TARGET_PAGE_SIZE); } - goto out; + return 0; out_free: while (i--) { @@ -66,8 +64,7 @@ out_free: } g_free(ring->pages); -out: - return rc; + return -ENOMEM; } void *pvrdma_ring_next_elem_read(PvrdmaRing *ring) -- 2.24.1