From nobody Mon Feb 9 23:40:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1642171235; cv=none; d=zohomail.com; s=zohoarc; b=lscWuH2bl38RBBNQNkueHYGwYuJLf26z6k79L7MlCt58K9WzbnqNgYcmQ66+IeqJHNQhAB9xpF6IjrbI0EDZDgwnTozgaNJGB6BIIJCuv4xzN9mUAlycWuyMx09415oSdof+6y383aqNSVIHprCqJpd013Z0ghnQU2SkVmZda5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642171235; 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; bh=PLiIkrucJUA1WnF+tyMbVFqnHpMqP38pdd3opWZV97c=; b=iB7C9R0QchOmtytDI9uuqG20l2jUsunU/8sqtkozumkkHb0dGzg5UEJZhAyJ6XZeobZm5l6qWoU3UsszwBkvPGaUjwMN/0Qp1P+UJsewwQw4peLidyslun9FBBtFk7Ytz1NHXUbw3Nrz2a5lj1heGXxrQ0ICKe5LgxTZC8qAHCg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16421712355691020.4246388532346; Fri, 14 Jan 2022 06:40:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-660-elrRgQtfPsCWgNh2nepX_Q-1; Fri, 14 Jan 2022 09:40:31 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F02001926DB1; Fri, 14 Jan 2022 14:40:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C83C584D1C; Fri, 14 Jan 2022 14:40:25 +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 939A71806D2F; Fri, 14 Jan 2022 14:40:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20EEeHsN029315 for ; Fri, 14 Jan 2022 09:40:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2B06E7B6F2; Fri, 14 Jan 2022 14:40:17 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 955347B6F1 for ; Fri, 14 Jan 2022 14:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642171234; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=PLiIkrucJUA1WnF+tyMbVFqnHpMqP38pdd3opWZV97c=; b=FvN7QT+c1FQrH9GUh5IuBkbKUDpSUh/OTxD05djJiw0jp8Om7mxXOtGpUJ7YUNNgN5ghzs FPAXLnJxGalyF/DVW26QHjaSKM/EMGgkAHFF1wFxEl1+l29uDP81eJr/nq3022oVsTonO3 ibJYulK3NqQBYxG+Nr8CQ2vvlovRSG4= X-MC-Unique: elrRgQtfPsCWgNh2nepX_Q-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 10/11] libxl: Remove needless labels Date: Fri, 14 Jan 2022 15:39:54 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642171236834100005 Content-Type: text/plain; charset="utf-8" After previous cleanups some labels are needless: they contain nothing but a return statement. Drop such labels and return directly. Signed-off-by: Michal Privoznik --- src/libxl/xen_common.c | 7 ++-- src/libxl/xen_xl.c | 80 ++++++++++++++---------------------------- src/libxl/xen_xm.c | 7 ++-- 3 files changed, 31 insertions(+), 63 deletions(-) diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c index 2d363ac2fb..c3fa98b71d 100644 --- a/src/libxl/xen_common.c +++ b/src/libxl/xen_common.c @@ -2313,17 +2313,14 @@ xenFormatVif(virConf *conf, for (i =3D 0; i < def->nnets; i++) { if (xenFormatNet(conn, netVal, def->nets[i], hvm, vif_typename) < 0) - goto cleanup; + return -1; } =20 if (netVal->list !=3D NULL && virConfSetValue(conf, "vif", &netVal) < 0) - goto cleanup; + return -1; =20 return 0; - - cleanup: - return -1; } =20 =20 diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index 25bf1f7893..e3a87890af 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -392,7 +392,6 @@ static int xenParseXLVnuma(virConf *conf, virDomainDef *def) { - int ret =3D -1; size_t vcpus =3D 0; size_t nr_nodes =3D 0; size_t vnodeCnt =3D 0; @@ -416,7 +415,7 @@ xenParseXLVnuma(virConf *conf, } =20 if (!virDomainNumaSetNodeCount(numa, nr_nodes)) - goto cleanup; + return -1; =20 cpu =3D virCPUDefNew(); =20 @@ -439,7 +438,7 @@ xenParseXLVnuma(virConf *conf, virReportError(VIR_ERR_INTERNAL_ERROR, _("vnuma vnode invalid format '%s'"), str); - goto cleanup; + return -1; } data++; =20 @@ -452,18 +451,18 @@ xenParseXLVnuma(virConf *conf, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("vnuma vnode %zu contains inv= alid pnode value '%s'"), vnodeCnt, data); - goto cleanup; + return -1; } pnode =3D cellid; } else if (STRPREFIX(str, "size")) { if (virStrToLong_ull(data, NULL, 10, &kbsize) < 0) - goto cleanup; + return -1; =20 virDomainNumaSetNodeMemorySize(numa, vnodeCnt, (kb= size * 1024)); =20 } else if (STRPREFIX(str, "vcpus")) { if (virBitmapParse(data, &cpumask, VIR_DOMAIN_CPUM= ASK_LEN) < 0) - goto cleanup; + return -1; =20 virDomainNumaSetNodeCpumask(numa, vnodeCnt, cpumas= k); vcpus +=3D virBitmapCountBits(cpumask); @@ -474,7 +473,7 @@ xenParseXLVnuma(virConf *conf, unsigned int value; =20 if (!(token =3D g_strsplit(data, ",", 0))) - goto cleanup; + return -1; =20 ndistances =3D g_strv_length(token); =20 @@ -482,23 +481,23 @@ xenParseXLVnuma(virConf *conf, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("vnuma pnode %d configured '%s' (= count %zu) doesn't fit the number of specified vnodes %zu"), pnode, str, ndistances, nr_nodes); - goto cleanup; + return -1; } =20 if (virDomainNumaSetNodeDistanceCount(numa, vnodeC= nt, ndistances) !=3D ndistances) - goto cleanup; + return -1; =20 for (i =3D 0; i < ndistances; i++) { if ((virStrToLong_ui(token[i], NULL, 10, &valu= e) < 0) || (virDomainNumaSetNodeDistance(numa, vnodeC= nt, i, value) !=3D value)) - goto cleanup; + return -1; } =20 } else { virReportError(VIR_ERR_CONF_SYNTAX, _("Invalid vnuma configuration for = vnode %zu"), vnodeCnt); - goto cleanup; + return -1; } } vnode =3D vnode->next; @@ -511,7 +510,7 @@ xenParseXLVnuma(virConf *conf, virReportError(VIR_ERR_CONF_SYNTAX, _("Incomplete vnuma configuration for vnode %zu= "), vnodeCnt); - goto cleanup; + return -1; } =20 list =3D list->next; @@ -525,16 +524,13 @@ xenParseXLVnuma(virConf *conf, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("vnuma configuration contains %zu vcpus, which is= greater than %zu maxvcpus"), vcpus, def->maxvcpus); - goto cleanup; + return -1; } =20 cpu->type =3D VIR_CPU_TYPE_GUEST; def->cpu =3D g_steal_pointer(&cpu); =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 static int @@ -571,8 +567,6 @@ xenParseXLXenbusLimits(virConf *conf, virDomainDef *def) static int xenParseXLDiskSrc(virDomainDiskDef *disk, char *srcstr) { - int ret =3D -1; - /* A NULL source is valid, e.g. an empty CDROM */ if (srcstr =3D=3D NULL) return 0; @@ -581,19 +575,16 @@ xenParseXLDiskSrc(virDomainDiskDef *disk, char *srcst= r) g_autofree char *tmpstr =3D NULL; =20 if (!(tmpstr =3D virStringReplace(srcstr, "\\\\", "\\"))) - goto cleanup; + return -1; =20 virDomainDiskSetType(disk, VIR_STORAGE_TYPE_NETWORK); disk->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_RBD; - ret =3D virStorageSourceParseRBDColonString(tmpstr, disk->src); - } else { - virDomainDiskSetSource(disk, srcstr); - - ret =3D 0; + return virStorageSourceParseRBDColonString(tmpstr, disk->src); } =20 - cleanup: - return ret; + virDomainDiskSetSource(disk, srcstr); + + return 0; } =20 =20 @@ -1398,7 +1389,7 @@ xenFormatXLDomainVnuma(virConf *conf, nr_nodes =3D virDomainNumaGetNodeCount(numa); for (i =3D 0; i < nr_nodes; i++) { if (xenFormatXLVnuma(vnumaVal, numa, i, nr_nodes) < 0) - goto cleanup; + return -1; } =20 if (vnumaVal->list !=3D NULL && @@ -1406,9 +1397,6 @@ xenFormatXLDomainVnuma(virConf *conf, return -1; =20 return 0; - - cleanup: - return -1; } =20 static int @@ -1645,7 +1633,7 @@ xenFormatXLDomainDisks(virConf *conf, virDomainDef *d= ef) continue; =20 if (xenFormatXLDisk(diskVal, def->disks[i]) < 0) - goto cleanup; + return -1; } =20 if (diskVal->list !=3D NULL && @@ -1653,9 +1641,6 @@ xenFormatXLDomainDisks(virConf *conf, virDomainDef *d= ef) return -1; =20 return 0; - - cleanup: - return -1; } =20 =20 @@ -1762,7 +1747,7 @@ xenFormatXLInputDevs(virConf *conf, virDomainDef *def) for (i =3D 0; i < def->ninputs; i++) { if (def->inputs[i]->bus =3D=3D VIR_DOMAIN_INPUT_BUS_USB) { if (xenConfigSetInt(conf, "usb", 1) < 0) - goto error; + return -1; =20 switch (def->inputs[i]->type) { case VIR_DOMAIN_INPUT_TYPE_MOUSE: @@ -1794,17 +1779,15 @@ xenFormatXLInputDevs(virConf *conf, virDomainDef *d= ef) /* for compatibility with Xen <=3D 4.2, use old syntax when * only one device present */ if (xenConfigSetString(conf, "usbdevice", usbdevices->list= ->str) < 0) - goto error; + return -1; } else { if (virConfSetValue(conf, "usbdevice", &usbdevices) < 0) - goto error; + return -1; } } } =20 return 0; - error: - return -1; } =20 static int @@ -1847,7 +1830,7 @@ xenFormatXLUSBController(virConf *conf, break; =20 default: - goto error; + return -1; } } =20 @@ -1873,9 +1856,6 @@ xenFormatXLUSBController(virConf *conf, return -1; =20 return 0; - - error: - return -1; } =20 =20 @@ -1993,17 +1973,14 @@ xenFormatXLDomainChannels(virConf *conf, virDomainD= ef *def) continue; =20 if (xenFormatXLChannel(channelVal, def->channels[i]) < 0) - goto cleanup; + return -1; } =20 if (channelVal->list !=3D NULL && virConfSetValue(conf, "channel", &channelVal) < 0) - goto cleanup; + return -1; =20 return 0; - - cleanup: - return -1; } =20 static int @@ -2043,12 +2020,9 @@ xenFormatXLDomainNamespaceData(virConf *conf, virDom= ainDef *def) =20 if (args->list !=3D NULL && virConfSetValue(conf, "device_model_args", &args) < 0) - goto error; + return -1; =20 return 0; - - error: - return -1; } =20 virConf * diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c index f20307430c..2e636d874e 100644 --- a/src/libxl/xen_xm.c +++ b/src/libxl/xen_xm.c @@ -353,17 +353,14 @@ xenFormatXMDisks(virConf *conf, virDomainDef *def) continue; =20 if (xenFormatXMDisk(diskVal, def->disks[i]) < 0) - goto cleanup; + return -1; } =20 if (diskVal->list !=3D NULL && virConfSetValue(conf, "disk", &diskVal) < 0) - goto cleanup; + return -1; =20 return 0; - - cleanup: - return -1; } =20 =20 --=20 2.34.1