From nobody Sun Feb 8 19:21:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569514474; cv=none; d=zoho.com; s=zohoarc; b=QggNgjMSoGdQL3axupK56rwokijloCFX5xOpIs1XUonhJjn57I1+GW7aKOa2CxwUVi17v8t26fmf/Q76E4UNfNgl976UGJ9vSE2Vs5Suzp6cpA7C/onCXyLw5EBdJoAnryJarxh1VEaX10AH6Vyg12bnhg5OzILbnQjF10jFiEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569514474; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=JF4Kf/Pu+l+92TEjAIuz0vbViKPC16gV0bX4nMy9mf8=; b=Iz9dHjhm7SUUtpNgSnRyO5N1zSeWOsMyBDwsn24A6UPLrL4ULmyNq01AmBFFJ6NNIWTWze2tbbRYdXvvhML7ZdHRDkUu1vNI8GH+hI1Aw+VFveAKPYyYPxSzQhQAa2vteqO6UWrN8kp6XMeHEUYvqpvS+pLkmFrGBX3hQ2ug574= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569514474177612.2815288077353; Thu, 26 Sep 2019 09:14:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8CD1010DCC8B; Thu, 26 Sep 2019 16:14:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F2995D9C3; Thu, 26 Sep 2019 16:14:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 151214EE6D; Thu, 26 Sep 2019 16:14:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QGDs5H003346 for ; Thu, 26 Sep 2019 12:13:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id CAD435D9DC; Thu, 26 Sep 2019 16:13:54 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5232B5D9E1 for ; Thu, 26 Sep 2019 16:13:52 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 18:12:08 +0200 Message-Id: <46d69387570ae2843c186fc53e57ae29be4fe7cd.1569514291.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 12/39] qemu: Drop some 'cleanup' labels X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Thu, 26 Sep 2019 16:14:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Previous patches rendered some of 'cleanup' labels needless. Drop them. Signed-off-by: Michal Privoznik --- src/qemu/qemu_cgroup.c | 25 ++++++++----------- src/qemu/qemu_domain.c | 56 +++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 49 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index e3ea1e30ab..9684bf3662 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -379,13 +379,13 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm, qemuDomainObjPrivatePtr priv =3D vm->privateData; VIR_AUTOFREE(char *) path =3D NULL; int perms; - int rv, ret =3D -1; + int rv; =20 if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE= S)) return 0; =20 if (qemuDomainGetHostdevPath(dev, &path, &perms) < 0) - goto cleanup; + return -1; =20 VIR_DEBUG("Cgroup allow %s perms=3D%d", path, perms); rv =3D virCgroupAllowDevicePath(priv->cgroup, path, perms, false); @@ -393,7 +393,7 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm, virCgroupGetDevicePermsString(perms), rv); if (rv < 0) - goto cleanup; + return -1; =20 if (qemuHostdevNeedsVFIO(dev) && !qemuDomainNeedsVFIO(vm->def)) { @@ -403,13 +403,10 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm, virDomainAuditCgroupPath(vm, priv->cgroup, "allow", QEMU_DEV_VFIO, "rw", rv); if (rv < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 =20 @@ -430,13 +427,13 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm, { qemuDomainObjPrivatePtr priv =3D vm->privateData; VIR_AUTOFREE(char *) path =3D NULL; - int rv, ret =3D -1; + int rv; =20 if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE= S)) return 0; =20 if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0) - goto cleanup; + return -1; =20 VIR_DEBUG("Cgroup deny %s", path); rv =3D virCgroupDenyDevicePath(priv->cgroup, path, @@ -444,7 +441,7 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm, virDomainAuditCgroupPath(vm, priv->cgroup, "deny", path, "rwm", rv); if (rv < 0) - goto cleanup; + return -1; =20 if (qemuHostdevNeedsVFIO(dev) && !qemuDomainNeedsVFIO(vm->def)) { @@ -454,12 +451,10 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm, virDomainAuditCgroupPath(vm, priv->cgroup, "deny", QEMU_DEV_VFIO, "rwm", rv); if (rv < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bfe7838220..e92c2053c1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -12854,7 +12854,6 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, char **path, int *perms) { - int ret =3D -1; virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; @@ -12877,10 +12876,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr d= ev, pcisrc->addr.slot, pcisrc->addr.function); if (!pci) - goto cleanup; + return -1; =20 if (!(tmpPath =3D virPCIDeviceGetIOMMUGroupDev(pci))) - goto cleanup; + return -1; =20 perm =3D VIR_CGROUP_DEVICE_RW; } @@ -12893,10 +12892,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr d= ev, usbsrc->device, NULL); if (!usb) - goto cleanup; + return -1; =20 if (VIR_STRDUP(tmpPath, virUSBDeviceGetPath(usb)) < 0) - goto cleanup; + return -1; perm =3D VIR_CGROUP_DEVICE_RW; break; =20 @@ -12915,10 +12914,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr d= ev, dev->shareable); =20 if (!scsi) - goto cleanup; + return -1; =20 if (VIR_STRDUP(tmpPath, virSCSIDeviceGetPath(scsi)) < 0) - goto cleanup; + return -1; perm =3D virSCSIDeviceGetReadonly(scsi) ? VIR_CGROUP_DEVICE_READ : VIR_CGROUP_DEVICE_RW; } @@ -12928,10 +12927,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr d= ev, if (hostsrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST) { if (!(host =3D virSCSIVHostDeviceNew(hostsrc->wwpn))) - goto cleanup; + return -1; =20 if (VIR_STRDUP(tmpPath, virSCSIVHostDeviceGetPath(host)) <= 0) - goto cleanup; + return -1; perm =3D VIR_CGROUP_DEVICE_RW; } break; @@ -12939,7 +12938,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: if (!(tmpPath =3D virMediatedDeviceGetIOMMUGroupDev(mdevsrc->u= uidstr))) - goto cleanup; + return -1; =20 perm =3D VIR_CGROUP_DEVICE_RW; break; @@ -12957,9 +12956,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, VIR_STEAL_PTR(*path, tmpPath); if (perms) *perms =3D perm; - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -13473,22 +13470,19 @@ qemuDomainSetupHostdev(virQEMUDriverConfigPtr cfg= ATTRIBUTE_UNUSED, virDomainHostdevDefPtr dev, const struct qemuDomainCreateDeviceData *data) { - int ret =3D -1; VIR_AUTOFREE(char *) path =3D NULL; =20 if (qemuDomainGetHostdevPath(dev, &path, NULL) < 0) - goto cleanup; + return -1; =20 if (qemuDomainCreateDevice(path, data, false) < 0) - goto cleanup; + return -1; =20 if (qemuHostdevNeedsVFIO(dev) && qemuDomainCreateDevice(QEMU_DEV_VFIO, data, false) < 0) - goto cleanup; + return -1; =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -14534,23 +14528,20 @@ int qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev) { - int ret =3D -1; VIR_AUTOFREE(char *) path =3D NULL; =20 if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0) - goto cleanup; + return -1; =20 if (qemuDomainNamespaceMknodPath(vm, path) < 0) - goto cleanup; + return -1; =20 if (qemuHostdevNeedsVFIO(hostdev) && !qemuDomainNeedsVFIO(vm->def) && qemuDomainNamespaceMknodPath(vm, QEMU_DEV_VFIO) < 0) - goto cleanup; + return -1; =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -14569,23 +14560,20 @@ int qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev) { - int ret =3D -1; VIR_AUTOFREE(char *) path =3D NULL; =20 if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0) - goto cleanup; + return -1; =20 if (qemuDomainNamespaceUnlinkPath(vm, path) < 0) - goto cleanup; + return -1; =20 if (qemuHostdevNeedsVFIO(hostdev) && !qemuDomainNeedsVFIO(vm->def) && qemuDomainNamespaceUnlinkPath(vm, QEMU_DEV_VFIO) < 0) - goto cleanup; + return -1; =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list