Remove unneeded labels of the following util files: virhostcpu.c virnetdevvportprofile.c virnetlink.c virpci.c virsocketaddr.c virstoragefile.c Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/util/virhostcpu.c | 6 ++-- src/util/virnetdevvportprofile.c | 52 ++++++++++++++------------------ src/util/virnetlink.c | 4 +-- src/util/virpci.c | 14 +++------ src/util/virsocketaddr.c | 11 ++----- src/util/virstoragefile.c | 4 +-- 6 files changed, 35 insertions(+), 56 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 22102f2c75..7f14340f49 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1119,7 +1119,7 @@ virHostCPUGetThreadsPerSubcore(virArch arch) * In either case, falling back to the subcore-unaware thread * counting logic is the right thing to do */ if (!virFileExists(KVM_DEVICE)) - goto out; + return 0; if ((kvmfd = open(KVM_DEVICE, O_RDONLY)) < 0) { /* This can happen when running as a regular user if @@ -1129,8 +1129,7 @@ virHostCPUGetThreadsPerSubcore(virArch arch) virReportSystemError(errno, _("Failed to open '%s'"), KVM_DEVICE); - threads_per_subcore = -1; - goto out; + return -1; } /* For Phyp and KVM based guests the ioctl for KVM_CAP_PPC_SMT @@ -1143,7 +1142,6 @@ virHostCPUGetThreadsPerSubcore(virArch arch) VIR_FORCE_CLOSE(kvmfd); } - out: return threads_per_subcore; } diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c index c5db49b932..5ca96132c4 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -518,7 +518,6 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf, bool is8021Qbg, uint16_t *status) { - int rc = -1; struct nlattr *tb_port[IFLA_PORT_MAX + 1] = { NULL, }; if (vf == PORT_SELF_VF && nltarget_kernel) { @@ -527,12 +526,12 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf, ifla_port_policy)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("error parsing IFLA_PORT_SELF part")); - goto cleanup; + return -1; } } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("IFLA_PORT_SELF is missing")); - goto cleanup; + return -1; } } else { if (tb[IFLA_VF_PORTS]) { @@ -546,14 +545,14 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("error while iterating over " "IFLA_VF_PORTS part")); - goto cleanup; + return -1; } if (nla_parse_nested(tb_port, IFLA_PORT_MAX, tb_vf_ports, ifla_port_policy)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("error parsing IFLA_VF_PORT part")); - goto cleanup; + return -1; } /* This ensures that the given VF is present in the @@ -601,7 +600,7 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("error parsing IFLA_VF_PORT " "during error reporting")); - goto cleanup; + return -1; } if (tb_port[IFLA_PORT_INSTANCE_UUID]) { virUUIDFormat((unsigned char *) @@ -613,31 +612,29 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf, *(uint32_t *)RTA_DATA(tb_port[IFLA_PORT_VF]) : -1, uuidstr); } - goto cleanup; + return -1; } } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("IFLA_VF_PORTS is missing")); - goto cleanup; + return -1; } } if (tb_port[IFLA_PORT_RESPONSE]) { *status = *(uint16_t *)RTA_DATA(tb_port[IFLA_PORT_RESPONSE]); - rc = 0; } else { if (is8021Qbg) { /* no in-progress here; may be missing */ *status = PORT_PROFILE_RESPONSE_INPROGRESS; - rc = 0; } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no IFLA_PORT_RESPONSE found in netlink message")); - goto cleanup; + return -1; } } - cleanup: - return rc; + + return 0; } @@ -1051,7 +1048,6 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname, enum virNetDevVPortProfileLinkOp virtPortOp, bool setlink_only) { - int rc = -1; int op = PORT_REQUEST_ASSOCIATE; struct ifla_port_vsi portVsi = { .vsi_mgr_id = virtPort->managerID, @@ -1069,7 +1065,7 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname, if (virNetDevVPortProfileGetPhysdevAndVlan(ifname, &physdev_ifindex, physdev_ifname, &vlanid) < 0) { - goto cleanup; + return -1; } if (vlanid < 0) @@ -1095,22 +1091,20 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname, default: virReportError(VIR_ERR_INTERNAL_ERROR, _("operation type %d not supported"), virtPortOp); - goto cleanup; + return -1; } - rc = virNetDevVPortProfileOpCommon(physdev_ifname, physdev_ifindex, - nltarget_kernel, - macaddr, - vlanid, - NULL, - &portVsi, - virtPort->instanceID, - NULL, - vf, - op, - setlink_only); - cleanup: - return rc; + return virNetDevVPortProfileOpCommon(physdev_ifname, physdev_ifindex, + nltarget_kernel, + macaddr, + vlanid, + NULL, + &portVsi, + virtPort->instanceID, + NULL, + vf, + op, + setlink_only); } /* Returns 0 on success, -1 on general failure, and -2 on timeout */ diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c index 2542703092..710b4f5f51 100644 --- a/src/util/virnetlink.c +++ b/src/util/virnetlink.c @@ -184,16 +184,14 @@ virNetlinkCreateSocket(int protocol) } nl_socket_enable_msg_peek(nlhandle); - cleanup: return nlhandle; error: if (nlhandle) { nl_close(nlhandle); virNetlinkFree(nlhandle); - nlhandle = NULL; } - goto cleanup; + return NULL; } static virNetlinkHandle * diff --git a/src/util/virpci.c b/src/util/virpci.c index 06d855a95b..0b1222373e 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2146,32 +2146,28 @@ virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf) { char *p = NULL; - int ret = -1; if ((address == NULL) || (logStrToLong_ui(address, &p, 16, &bdf->domain) == -1)) { - goto out; + return -1; } if ((p == NULL) || (logStrToLong_ui(p+1, &p, 16, &bdf->bus) == -1)) { - goto out; + return -1; } if ((p == NULL) || (logStrToLong_ui(p+1, &p, 16, &bdf->slot) == -1)) { - goto out; + return -1; } if ((p == NULL) || (logStrToLong_ui(p+1, &p, 16, &bdf->function) == -1)) { - goto out; + return -1; } - ret = 0; - - out: - return ret; + return 0; } diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index ef51d3fa7d..f90022827e 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -1102,27 +1102,24 @@ virSocketAddrPrefixToNetmask(unsigned int prefix, virSocketAddrPtr netmask, int family) { - int result = -1; - netmask->data.stor.ss_family = AF_UNSPEC; /* assume failure */ if (family == AF_INET) { int ip; if (prefix > 32) - goto error; + return -1; ip = prefix ? ~((1 << (32 - prefix)) - 1) : 0; netmask->data.inet4.sin_addr.s_addr = htonl(ip); netmask->data.stor.ss_family = AF_INET; netmask->len = sizeof(struct sockaddr_in); - result = 0; } else if (family == AF_INET6) { size_t i = 0; if (prefix > 128) - goto error; + return -1; while (prefix >= 8) { /* do as much as possible an entire byte at a time */ @@ -1140,11 +1137,9 @@ virSocketAddrPrefixToNetmask(unsigned int prefix, } netmask->data.stor.ss_family = AF_INET6; netmask->len = sizeof(struct sockaddr_in6); - result = 0; } - error: - return result; + return 0; } /** diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index c9f3e5f865..e46ac99219 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -533,14 +533,12 @@ qcow2GetExtensions(const char *buf, } case QCOW2_HDR_EXTENSION_END: - goto done; + return 0; } offset += len; } - done: - return 0; } -- 2.24.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list