This patch remove unneeded labels for the following files: qemu_capabilities.c qemu_domain_address.c qemu_hostdev.c qemu_hotplug.c qemu_migration_cookie.c qemu_migration_params.c Next patch will handle the remaining QEMU files that can be cleaned up. Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/qemu/qemu_capabilities.c | 15 +++------ src/qemu/qemu_domain_address.c | 52 +++++++++++++++----------------- src/qemu/qemu_hostdev.c | 11 +++---- src/qemu/qemu_hotplug.c | 15 ++++----- src/qemu/qemu_migration_cookie.c | 10 +++--- src/qemu/qemu_migration_params.c | 11 +++---- 6 files changed, 47 insertions(+), 67 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 0929fd3e28..da0c7a257f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -781,23 +781,22 @@ virQEMUCapsFindBinaryForArch(virArch hostarch, if (hostarch == VIR_ARCH_AARCH64 && guestarch == VIR_ARCH_ARMV7L) { archstr = virQEMUCapsArchToString(hostarch); if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL) - goto out; + return ret; } /* First attempt: try the guest architecture as it is */ archstr = virQEMUCapsArchToString(guestarch); if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL) - goto out; + return ret; /* Second attempt: try looking up by target instead */ target = virQEMUCapsFindTarget(hostarch, guestarch); if (target != guestarch) { archstr = virQEMUCapsArchToString(target); if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL) - goto out; + return ret; } - out: return ret; } @@ -5013,13 +5012,11 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, qemuCaps->kvmSupportsNesting = virQEMUCapsKVMSupportsNesting(); } - cleanup: return qemuCaps; error: virObjectUnref(qemuCaps); - qemuCaps = NULL; - goto cleanup; + return NULL; } static void * @@ -5052,13 +5049,11 @@ virQEMUCapsLoadFile(const char *filename, if (virQEMUCapsLoadCache(priv->hostArch, qemuCaps, filename) < 0) goto error; - cleanup: return qemuCaps; error: virObjectUnref(qemuCaps); - qemuCaps = NULL; - goto cleanup; + return NULL; } diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index b077240899..0e28ecf1d5 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1257,7 +1257,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def, /* Only PCI host devices are subject to isolation */ if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { - goto skip; + return 0; } hostAddr = &hostdev->source.subsys.u.pci.addr; @@ -1265,7 +1265,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def, /* If a non-default isolation has already been assigned to the * device, we can avoid looking up the information again */ if (info->isolationGroup > 0) - goto skip; + return 0; /* The isolation group depends on the IOMMU group assigned by the host */ tmp = virPCIDeviceAddressGetIOMMUGroupNum(hostAddr); @@ -1275,7 +1275,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def, "%04x:%02x:%02x.%x, device won't be isolated", hostAddr->domain, hostAddr->bus, hostAddr->slot, hostAddr->function); - goto skip; + return 0; } /* The isolation group for a host device is its IOMMU group, @@ -1301,13 +1301,13 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def, * require us to isolate the guest device, so we can skip them */ if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK || virDomainNetResolveActualType(iface) != VIR_DOMAIN_NET_TYPE_HOSTDEV) { - goto skip; + return 0; } /* If a non-default isolation has already been assigned to the * device, we can avoid looking up the information again */ if (info->isolationGroup > 0) - goto skip; + return 0; /* Obtain a synthetic isolation group for the device, since at this * point in time we don't have access to the IOMMU group of the host @@ -1319,7 +1319,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def, "configured to use hostdev-backed network '%s', " "device won't be isolated", iface->data.network.name); - goto skip; + return 0; } info->isolationGroup = tmp; @@ -1329,7 +1329,6 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def, iface->data.network.name, info->isolationGroup); } - skip: return 0; } @@ -2131,7 +2130,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, continue; if (qemuDomainPCIAddressReserveNextAddr(addrs, &cont->info) < 0) - goto error; + return -1; } } @@ -2142,7 +2141,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, /* Only support VirtIO-9p-pci so far. If that changes, * we might need to skip devices here */ if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->fss[i]->info) < 0) - goto error; + return -1; } /* Network interfaces */ @@ -2159,7 +2158,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, } if (qemuDomainPCIAddressReserveNextAddr(addrs, &net->info) < 0) - goto error; + return -1; } /* Sound cards */ @@ -2177,7 +2176,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, } if (qemuDomainPCIAddressReserveNextAddr(addrs, &sound->info) < 0) - goto error; + return -1; } /* Device controllers (SCSI, USB, but not IDE, FDC or CCID) */ @@ -2246,7 +2245,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, if (virDomainPCIAddressReserveAddr(addrs, &addr, cont->info.pciConnectFlags, cont->info.isolationGroup) < 0) { - goto error; + return -1; } cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; @@ -2257,14 +2256,14 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, if (virDomainPCIAddressReserveNextAddr(addrs, &cont->info, cont->info.pciConnectFlags, addr.function) < 0) { - goto error; + return -1; } cont->info.addr.pci.multi = addr.multi; } } else { if (qemuDomainPCIAddressReserveNextAddr(addrs, &cont->info) < 0) - goto error; + return -1; } } @@ -2292,11 +2291,11 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("virtio disk cannot have an address of type '%s'"), virDomainDeviceAddressTypeToString(def->disks[i]->info.type)); - goto error; + return -1; } if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->disks[i]->info) < 0) - goto error; + return -1; } /* Host PCI devices */ @@ -2320,7 +2319,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, if (qemuDomainPCIAddressReserveNextAddr(addrs, def->hostdevs[i]->info) < 0) - goto error; + return -1; } /* memballoon. the qemu driver only accepts virtio memballoon devices */ @@ -2328,7 +2327,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, virDeviceInfoPCIAddressIsWanted(&def->memballoon->info)) { if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->memballoon->info) < 0) - goto error; + return -1; } /* the qemu driver only accepts virtio rng devices */ @@ -2337,7 +2336,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, continue; if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->rngs[i]->info) < 0) - goto error; + return -1; } /* A watchdog - check if it is a PCI device */ @@ -2345,7 +2344,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, def->watchdog->model == VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB && virDeviceInfoPCIAddressIsWanted(&def->watchdog->info)) { if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->watchdog->info) < 0) - goto error; + return -1; } /* Video devices */ @@ -2358,7 +2357,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, continue; if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[i]->info) < 0) - goto error; + return -1; } /* Shared Memory */ @@ -2367,7 +2366,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, continue; if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->shmems[i]->info) < 0) - goto error; + return -1; } for (i = 0; i < def->ninputs; i++) { if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_VIRTIO || @@ -2375,7 +2374,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, continue; if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->inputs[i]->info) < 0) - goto error; + return -1; } for (i = 0; i < def->nparallels; i++) { /* Nada - none are PCI based (yet) */ @@ -2388,7 +2387,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, continue; if (qemuDomainPCIAddressReserveNextAddr(addrs, &chr->info) < 0) - goto error; + return -1; } for (i = 0; i < def->nchannels; i++) { /* Nada - none are PCI based (yet) */ @@ -2402,13 +2401,10 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->vsock->info) < 0) - goto error; + return -1; } return 0; - - error: - return -1; } diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 6ab052724a..1774850640 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -243,17 +243,14 @@ qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver, virQEMUCapsPtr qemuCaps, unsigned int flags) { - int ret = -1; virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; if (!qemuHostdevPreparePCIDevicesCheckSupport(hostdevs, nhostdevs, qemuCaps)) - goto out; + return -1; - ret = virHostdevPreparePCIDevices(hostdev_mgr, QEMU_DRIVER_NAME, - name, uuid, hostdevs, - nhostdevs, flags); - out: - return ret; + return virHostdevPreparePCIDevices(hostdev_mgr, QEMU_DRIVER_NAME, + name, uuid, hostdevs, + nhostdevs, flags); } int diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f2a9386433..31d455505b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2894,41 +2894,38 @@ qemuDomainAttachHostDevice(virQEMUDriverPtr driver, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: if (qemuDomainAttachHostPCIDevice(driver, vm, hostdev) < 0) - goto error; + return -1; break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: if (qemuDomainAttachHostUSBDevice(driver, vm, hostdev) < 0) - goto error; + return -1; break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: if (qemuDomainAttachHostSCSIDevice(driver, vm, hostdev) < 0) - goto error; + return -1; break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: if (qemuDomainAttachSCSIVHostDevice(driver, vm, hostdev) < 0) - goto error; + return -1; break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: if (qemuDomainAttachMediatedDevice(driver, vm, hostdev) < 0) - goto error; + return -1; break; default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("hotplug is not supported for hostdev subsys type '%s'"), virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type)); - goto error; + return -1; } return 0; - - error: - return -1; } diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index 9cfb08951c..299bf17c9e 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -971,14 +971,12 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt) VIR_FREE(interfaces); - cleanup: return optr; error: VIR_FREE(interfaces); qemuMigrationCookieNetworkFree(optr); - optr = NULL; - goto cleanup; + return NULL; } @@ -1053,10 +1051,10 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt); if (!(ctxt->node = virXPathNode("./statistics", ctxt))) - goto cleanup; + return NULL; if (VIR_ALLOC(jobInfo) < 0) - goto cleanup; + return NULL; stats = &jobInfo->stats.mig; jobInfo->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED; @@ -1127,7 +1125,7 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt) virXPathInt("string(./" VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "[1])", ctxt, &stats->cpu_throttle_percentage); - cleanup: + return jobInfo; } diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index e6cf6b4b0b..9430ce1d00 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -480,14 +480,14 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr params, virReportError(VIR_ERR_INVALID_ARG, _("Unsupported compression method '%s'"), params[i].value.s); - goto error; + return -1; } if (migParams->compMethods & (1ULL << method)) { virReportError(VIR_ERR_INVALID_ARG, _("Compression method '%s' is specified twice"), params[i].value.s); - goto error; + return -1; } migParams->compMethods |= 1ULL << method; @@ -514,14 +514,14 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr params, !(migParams->compMethods & (1ULL << QEMU_MIGRATION_COMPRESS_MT))) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Turn multithread compression on to tune it")); - goto error; + return -1; } if (migParams->params[QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE].set && !(migParams->compMethods & (1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE))) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Turn xbzrle compression on to tune it")); - goto error; + return -1; } if (!migParams->compMethods && (flags & VIR_MIGRATE_COMPRESSED)) { @@ -531,9 +531,6 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr params, } return 0; - - error: - return -1; } -- 2.24.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list