Previous patches rendered some of 'cleanup' labels needless.
Drop them.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_cgroup.c | 25 +++++++++------------
src/qemu/qemu_domain.c | 50 ++++++++++++++++--------------------------
2 files changed, 29 insertions(+), 46 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index d54d01d4c0..d23318db8c 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -378,13 +378,13 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autofree char *path = NULL;
int perms;
- int rv, ret = -1;
+ int rv;
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICES))
return 0;
if (qemuDomainGetHostdevPath(dev, &path, &perms) < 0)
- goto cleanup;
+ return -1;
VIR_DEBUG("Cgroup allow %s perms=%d", path, perms);
rv = virCgroupAllowDevicePath(priv->cgroup, path, perms, false);
@@ -392,7 +392,7 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
virCgroupGetDevicePermsString(perms),
rv);
if (rv < 0)
- goto cleanup;
+ return -1;
if (qemuHostdevNeedsVFIO(dev)) {
VIR_DEBUG("Cgroup allow %s perms=%d", QEMU_DEV_VFIO,
VIR_CGROUP_DEVICE_RW);
@@ -401,13 +401,10 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
QEMU_DEV_VFIO, "rw", rv);
if (rv < 0)
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
@@ -428,13 +425,13 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autofree char *path = NULL;
- int rv, ret = -1;
+ int rv;
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICES))
return 0;
if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0)
- goto cleanup;
+ return -1;
VIR_DEBUG("Cgroup deny %s", path);
rv = virCgroupDenyDevicePath(priv->cgroup, path,
@@ -442,7 +439,7 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
virDomainAuditCgroupPath(vm, priv->cgroup,
"deny", path, "rwm", rv);
if (rv < 0)
- goto cleanup;
+ return -1;
if (qemuHostdevNeedsVFIO(dev) &&
!qemuDomainNeedsVFIO(vm->def)) {
@@ -452,12 +449,10 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
virDomainAuditCgroupPath(vm, priv->cgroup, "deny",
QEMU_DEV_VFIO, "rwm", rv);
if (rv < 0)
- goto cleanup;
+ return -1;
}
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index be769cb3ff..21a4dad37d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12879,7 +12879,6 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
char **path,
int *perms)
{
- int ret = -1;
virDomainHostdevSubsysUSBPtr usbsrc = &dev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
@@ -12903,10 +12902,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
pcisrc->addr.slot,
pcisrc->addr.function);
if (!pci)
- goto cleanup;
+ return -1;
if (!(tmpPath = virPCIDeviceGetIOMMUGroupDev(pci)))
- goto cleanup;
+ return -1;
perm = VIR_CGROUP_DEVICE_RW;
}
@@ -12919,7 +12918,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
usbsrc->device,
NULL);
if (!usb)
- goto cleanup;
+ return -1;
tmpPath = g_strdup(virUSBDeviceGetPath(usb));
perm = VIR_CGROUP_DEVICE_RW;
@@ -12940,7 +12939,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
dev->shareable);
if (!scsi)
- goto cleanup;
+ return -1;
tmpPath = g_strdup(virSCSIDeviceGetPath(scsi));
perm = virSCSIDeviceGetReadonly(scsi) ?
@@ -12952,7 +12951,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
if (hostsrc->protocol ==
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST) {
if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn)))
- goto cleanup;
+ return -1;
tmpPath = g_strdup(virSCSIVHostDeviceGetPath(host));
perm = VIR_CGROUP_DEVICE_RW;
@@ -12962,7 +12961,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr)))
- goto cleanup;
+ return -1;
perm = VIR_CGROUP_DEVICE_RW;
break;
@@ -12980,9 +12979,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
*path = g_steal_pointer(&tmpPath);
if (perms)
*perms = perm;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
@@ -13481,22 +13478,19 @@ qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg
G_GNUC_UNUSED,
virDomainHostdevDefPtr dev,
const struct qemuDomainCreateDeviceData *data)
{
- int ret = -1;
g_autofree char *path = NULL;
if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0)
- goto cleanup;
+ return -1;
if (qemuDomainCreateDevice(path, data, false) < 0)
- goto cleanup;
+ return -1;
if (qemuHostdevNeedsVFIO(dev) &&
qemuDomainCreateDevice(QEMU_DEV_VFIO, data, false) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
@@ -14529,23 +14523,20 @@ int
qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
{
- int ret = -1;
g_autofree char *path = NULL;
if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0)
- goto cleanup;
+ return -1;
if (qemuDomainNamespaceMknodPath(vm, path) < 0)
- goto cleanup;
+ return -1;
if (qemuHostdevNeedsVFIO(hostdev) &&
!qemuDomainNeedsVFIO(vm->def) &&
qemuDomainNamespaceMknodPath(vm, QEMU_DEV_VFIO) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
@@ -14564,23 +14555,20 @@ int
qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
{
- int ret = -1;
g_autofree char *path = NULL;
if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0)
- goto cleanup;
+ return -1;
if (qemuDomainNamespaceUnlinkPath(vm, path) < 0)
- goto cleanup;
+ return -1;
if (qemuHostdevNeedsVFIO(hostdev) &&
!qemuDomainNeedsVFIO(vm->def) &&
qemuDomainNamespaceUnlinkPath(vm, QEMU_DEV_VFIO) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
--
2.23.0