From nobody Mon Feb 9 09:28:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614788297; cv=none; d=zohomail.com; s=zohoarc; b=k0nMr2Lz+NF0DRgHWjwlq1ohZfpTT4cT0cvhKJm2h0KJXaXH3aIpDP2Wz3uJiP3nyz9hhOpOyO9xlceMnDr7ZJwL0TyWo+tgakvIPi3rR+ujQVHDWg8lfy/aLx8rVk3mexTy06bwu82ZHSG5WId3plgHPmy2hcPkuG7bjxiQjfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614788297; 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=3d0y5JShJ9iiqsjuwakO/JktlYOtDpA/zlR8XDB4V3k=; b=atbRYIAorDKWeqSaly9wx+u7K6EHPBQIx2xHGWiWQh8OpTDa29Gp1D0tidGbgzBaLDCy51I1Pr4aCuT1O722zccTnjHbwCQ9RFBPUKQmCGY0IbrJpMLtVQkWXf0woT1qLX4ywGAbXJLQKlgisp2RLSIuwtZ4gQcnPmKJGJWcn7s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614788297907895.1666374941561; Wed, 3 Mar 2021 08:18:17 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-590-oZxRcdZdNwaY4c13Bn2aMQ-1; Wed, 03 Mar 2021 11:18:13 -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 E86FE874981; Wed, 3 Mar 2021 16:18:06 +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 BF1F47093A; Wed, 3 Mar 2021 16:18:06 +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 80FF418095CD; Wed, 3 Mar 2021 16:18:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123GI3Kj020478 for ; Wed, 3 Mar 2021 11:18:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4201070956; Wed, 3 Mar 2021 16:18:03 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.195.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 696F4226EE for ; Wed, 3 Mar 2021 16:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614788296; 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=3d0y5JShJ9iiqsjuwakO/JktlYOtDpA/zlR8XDB4V3k=; b=P9NQ1V3xN5u18ESfFtcy6plmj28tPmmPIF2YlS1Bvzc7bQY8QQEWmo9FR52zqaKtmw0qiS 7Pwd9nrphmljP1tsmqXBjYtfM9G8KHXX2sB4jzVw7DVphNUQ2aDrScoxto7zuvY0IJqkR7 TGaBvpOfi/ErGeiYSh4RbpWEVBJZ6JA= X-MC-Unique: oZxRcdZdNwaY4c13Bn2aMQ-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 4/4] node_device_conf: Remove redundant variables/labels Date: Wed, 3 Mar 2021 17:17:27 +0100 Message-Id: <595ddcc89a9906d9c33f5f04f5817329aa71722e.1614788020.git.khanicov@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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) Content-Type: text/plain; charset="utf-8" Signed-off-by: Kristina Hanicova --- src/conf/node_device_conf.c | 213 ++++++++++++++---------------------- 1 file changed, 85 insertions(+), 128 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index a64be74011..f13d70ca6c 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -778,7 +778,7 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt, virNodeDevCapDRMPtr drm) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1, val; + int val; g_autofree char *type =3D NULL; =20 ctxt->node =3D node; @@ -788,14 +788,11 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt, if ((val =3D virNodeDevDRMTypeFromString(type)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown drm type '%s' for '%s'"), type, def->nam= e); - goto out; + return -1; } drm->type =3D val; =20 - ret =3D 0; - - out: - return ret; + return 0; } =20 =20 @@ -1097,7 +1094,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree xmlNodePtr *nodes =3D NULL; size_t i; - int n, ret =3D -1; + int n; unsigned long long val; =20 ctxt->node =3D node; @@ -1107,7 +1104,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("no block device path supplied for '%s'"), def->name); - goto out; + return -1; } =20 storage->bus =3D virXPathString("string(./bus[1])", ctxt); @@ -1117,7 +1114,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, storage->serial =3D virXPathString("string(./serial[1])", ctxt); =20 if ((n =3D virXPathNodeSet("./capability", ctxt, &nodes)) < 0) - goto out; + return -1; =20 for (i =3D 0; i < n; i++) { g_autofree char *type =3D virXMLPropString(nodes[i], "type"); @@ -1126,7 +1123,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("missing storage capability type for '%s'"), def->name); - goto out; + return -1; } =20 if (STREQ(type, "hotpluggable")) { @@ -1148,7 +1145,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, if (virNodeDevCapsDefParseULongLong("number(./media_size[1])",= ctxt, &val, def, _("no removable media size= supplied for '%s'"), _("invalid removable media= size supplied for '%s'")) < 0) { - goto out; + return -1; } storage->removable_media_size =3D val; =20 @@ -1157,7 +1154,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown storage capability type '%s' for '%s= '"), type, def->name); - goto out; + return -1; } } =20 @@ -1166,13 +1163,11 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctx= t, if (virNodeDevCapsDefParseULongLong("number(./size[1])", ctxt, &va= l, def, _("no size supplied for '%s'"), _("invalid size supplied for '= %s'")) < 0) - goto out; + return -1; storage->size =3D val; } =20 - ret =3D 0; - out: - return ret; + return 0; } =20 =20 @@ -1183,7 +1178,6 @@ virNodeDevCapSCSIParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSCSIPtr scsi) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; =20 ctxt->node =3D node; =20 @@ -1191,31 +1185,29 @@ virNodeDevCapSCSIParseXML(xmlXPathContextPtr ctxt, &scsi->host, def, _("no SCSI host ID supplied for '%s'"), _("invalid SCSI host ID supplied for '= %s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseULong("number(./bus[1])", ctxt, &scsi->bus, def, _("no SCSI bus ID supplied for '%s'"), _("invalid SCSI bus ID supplied for '%= s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseULong("number(./target[1])", ctxt, &scsi->target, def, _("no SCSI target ID supplied for '%s'= "), _("invalid SCSI target ID supplied for= '%s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseULong("number(./lun[1])", ctxt, &scsi->lun, def, _("no SCSI LUN ID supplied for '%s'"), _("invalid SCSI LUN ID supplied for '%= s'")) < 0) - goto out; + return -1; =20 scsi->type =3D virXPathString("string(./type[1])", ctxt); =20 - ret =3D 0; - out: - return ret; + return 0; } =20 =20 @@ -1227,7 +1219,7 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ct= xt, { VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree xmlNodePtr *nodes =3D NULL; - int ret =3D -1, n =3D 0; + int n =3D 0; size_t i; =20 ctxt->node =3D node; @@ -1237,11 +1229,11 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr = ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("no target name supplied for '%s'"), def->name); - goto out; + return -1; } =20 if ((n =3D virXPathNodeSet("./capability", ctxt, &nodes)) < 0) - goto out; + return -1; =20 for (i =3D 0; i < n; ++i) { g_autofree char *type =3D NULL; @@ -1251,7 +1243,7 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ct= xt, virReportError(VIR_ERR_INTERNAL_ERROR, _("missing type for SCSI target capability for = '%s'"), def->name); - goto out; + return -1; } =20 if (STREQ(type, "fc_remote_port")) { @@ -1264,7 +1256,7 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ct= xt, &scsi_target->rport) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("missing rport name for '%s'"), def->name= ); - goto out; + return -1; } =20 if (virNodeDevCapsDefParseString("string(./wwpn[1])", @@ -1272,20 +1264,17 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr = ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("missing wwpn identifier for '%s'"), def->name); - goto out; + return -1; } } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown SCSI target capability type '%s' for= '%s'"), type, def->name); - goto out; + return -1; } } =20 - ret =3D 0; - - out: - return ret; + return 0; } =20 =20 @@ -1299,7 +1288,7 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, { VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree xmlNodePtr *nodes =3D NULL; - int ret =3D -1, n =3D 0; + int n =3D 0; size_t i; =20 ctxt->node =3D node; @@ -1309,19 +1298,19 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ct= xt, &scsi_host->host, def, _("no SCSI host ID supplied for '%= s'"), _("invalid SCSI host ID supplied f= or '%s'")) < 0) { - goto out; + return -1; } /* Optional unique_id value */ scsi_host->unique_id =3D -1; if (virNodeDevCapsDefParseIntOptional("number(./unique_id[1])", ct= xt, &scsi_host->unique_id, def, _("invalid unique_id supplie= d for '%s'")) < 0) { - goto out; + return -1; } } =20 if ((n =3D virXPathNodeSet("./capability", ctxt, &nodes)) < 0) - goto out; + return -1; =20 for (i =3D 0; i < n; i++) { g_autofree char *type =3D NULL; @@ -1331,7 +1320,7 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("missing SCSI host capability type for '%s'"), def->name); - goto out; + return -1; } =20 if (STREQ(type, "vport_ops")) { @@ -1351,7 +1340,7 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, _("no WWNN supplied for '%s', and " "auto-generation failed"), def->name); - goto out; + return -1; } } =20 @@ -1363,7 +1352,7 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, _("no WWPN supplied for '%s', and " "auto-generation failed"), def->name); - goto out; + return -1; } } =20 @@ -1376,14 +1365,11 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ct= xt, virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown SCSI host capability type '%s' for '= %s'"), type, def->name); - goto out; + return -1; } } =20 - ret =3D 0; - - out: - return ret; + return 0; } =20 =20 @@ -1396,7 +1382,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, VIR_XPATH_NODE_AUTORESTORE(ctxt) xmlNodePtr lnk; size_t i =3D -1; - int ret =3D -1, n =3D -1; + int n =3D -1; g_autofree char *type =3D NULL; g_autofree xmlNodePtr *nodes =3D NULL; =20 @@ -1407,13 +1393,13 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("no network interface supplied for '%s'"), def->name); - goto out; + return -1; } =20 net->address =3D virXPathString("string(./address[1])", ctxt); =20 if ((n =3D virXPathNodeSet("./feature", ctxt, &nodes)) < 0) - goto out; + return -1; =20 if (n > 0) net->features =3D virBitmapNew(VIR_NET_DEV_FEAT_LAST); @@ -1424,14 +1410,14 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, if (!(tmp =3D virXMLPropString(nodes[i], "name"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing network device feature name")); - goto out; + return -1; } =20 if ((val =3D virNetDevFeatureTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_XML_ERROR, _("unknown network device feature '%s'"), tmp); - goto out; + return -1; } ignore_value(virBitmapSetBit(net->features, val)); } @@ -1445,18 +1431,16 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid network type supplied for '%s'"), def->name); - goto out; + return -1; } net->subtype =3D val; } =20 lnk =3D virXPathNode("./link", ctxt); if (lnk && virInterfaceLinkParseXML(lnk, &net->lnk) < 0) - goto out; + return -1; =20 - ret =3D 0; - out: - return ret; + return 0; } =20 =20 @@ -1467,7 +1451,6 @@ virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr = ctxt, virNodeDevCapUSBIfPtr usb_if) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; =20 ctxt->node =3D node; =20 @@ -1475,31 +1458,29 @@ virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPt= r ctxt, &usb_if->number, def, _("no USB interface number supplied fo= r '%s'"), _("invalid USB interface number suppli= ed for '%s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseULong("number(./class[1])", ctxt, &usb_if->klass, def, _("no USB interface class supplied for= '%s'"), _("invalid USB interface class supplie= d for '%s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseULong("number(./subclass[1])", ctxt, &usb_if->subclass, def, _("no USB interface subclass supplied = for '%s'"), _("invalid USB interface subclass supp= lied for '%s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseULong("number(./protocol[1])", ctxt, &usb_if->protocol, def, _("no USB interface protocol supplied = for '%s'"), _("invalid USB interface protocol supp= lied for '%s'")) < 0) - goto out; + return -1; =20 usb_if->description =3D virXPathString("string(./description[1])", ctx= t); =20 - ret =3D 0; - out: - return ret; + return 0; } =20 =20 @@ -1534,7 +1515,6 @@ virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt, virNodeDevCapUSBDevPtr usb_dev) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; =20 ctxt->node =3D node; =20 @@ -1542,32 +1522,30 @@ virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt, &usb_dev->bus, def, _("no USB bus number supplied for '%s'= "), _("invalid USB bus number supplied for= '%s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseULong("number(./device[1])", ctxt, &usb_dev->device, def, _("no USB device number supplied for '= %s'"), _("invalid USB device number supplied = for '%s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseHexId("string(./vendor[1]/@id)", ctxt, &usb_dev->vendor, def, _("no USB vendor ID supplied for '%s'"= ), _("invalid USB vendor ID supplied for = '%s'")) < 0) - goto out; + return -1; =20 if (virNodeDevCapsDefParseHexId("string(./product[1]/@id)", ctxt, &usb_dev->product, def, _("no USB product ID supplied for '%s'= "), _("invalid USB product ID supplied for= '%s'")) < 0) - goto out; + return -1; =20 usb_dev->vendor_name =3D virXPathString("string(./vendor[1])", ctxt); usb_dev->product_name =3D virXPathString("string(./product[1])", ctxt); =20 - ret =3D 0; - out: - return ret; + return 0; } =20 =20 @@ -1579,7 +1557,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContext= Ptr ctxt, VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree xmlNodePtr *addrNodes =3D NULL; g_autofree char *numberStr =3D NULL; - int nAddrNodes, ret =3D -1; + int nAddrNodes; size_t i; =20 ctxt->node =3D iommuGroupNode; @@ -1588,18 +1566,18 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathConte= xtPtr ctxt, if (!numberStr) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing iommuGroup number attribute")); - goto cleanup; + return -1; } if (virStrToLong_ui(numberStr, NULL, 10, &pci_dev->iommuGroupNumber) < 0) { virReportError(VIR_ERR_XML_ERROR, _("invalid iommuGroup number attribute '%s'"), numberStr); - goto cleanup; + return -1; } =20 if ((nAddrNodes =3D virXPathNodeSet("./address", ctxt, &addrNodes)) < = 0) - goto cleanup; + return -1; =20 for (i =3D 0; i < nAddrNodes; i++) { g_autoptr(virPCIDeviceAddress) pciAddr =3D g_new0(virPCIDeviceAddr= ess, 1); @@ -1608,12 +1586,10 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathConte= xtPtr ctxt, if (VIR_APPEND_ELEMENT(pci_dev->iommuGroupDevices, pci_dev->nIommuGroupDevices, pciAddr) < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -1623,7 +1599,7 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt, virPCIELinkPtr lnk) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1, speed; + int speed; g_autofree char *speedStr =3D NULL; g_autofree char *portStr =3D NULL; =20 @@ -1632,7 +1608,7 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt, if (virXPathUInt("number(./@width)", ctxt, &lnk->width) < 0) { virReportError(VIR_ERR_XML_DETAIL, "%s", _("mandatory attribute 'width' is missing or malfor= med")); - goto cleanup; + return -1; } =20 if ((speedStr =3D virXPathString("string(./@speed)", ctxt))) { @@ -1640,7 +1616,7 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_XML_DETAIL, _("malformed 'speed' attribute: %s"), speedStr); - goto cleanup; + return -1; } lnk->speed =3D speed; } @@ -1650,15 +1626,13 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ct= xt, virReportError(VIR_ERR_XML_DETAIL, _("malformed 'port' attribute: %s"), portStr); - goto cleanup; + return -1; } } else { lnk->port =3D -1; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -1669,7 +1643,6 @@ virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt, { VIR_XPATH_NODE_AUTORESTORE(ctxt) xmlNodePtr lnk; - int ret =3D -1; =20 ctxt->node =3D pciExpressNode; =20 @@ -1678,7 +1651,7 @@ virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt, =20 if (virPCIEDeviceInfoLinkParseXML(ctxt, lnk, pci_express->link_cap) < 0) - goto cleanup; + return -1; } =20 if ((lnk =3D virXPathNode("./link[@validity=3D'sta']", ctxt))) { @@ -1686,12 +1659,10 @@ virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt, =20 if (virPCIEDeviceInfoLinkParseXML(ctxt, lnk, pci_express->link_sta) < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -1723,21 +1694,20 @@ static int virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt, virNodeDevCapPCIDevPtr pci_dev) { - int ret =3D -1; g_autofree xmlNodePtr *addresses =3D NULL; int naddresses =3D virXPathNodeSet("./address", ctxt, &addresses); g_autofree char *maxFuncsStr =3D virXPathString("string(./@maxCount)",= ctxt); size_t i; =20 if (naddresses < 0) - goto cleanup; + return -1; =20 if (maxFuncsStr && virStrToLong_uip(maxFuncsStr, NULL, 10, &pci_dev->max_virtual_functions) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Malformed 'maxCount' parameter")); - goto cleanup; + return -1; } =20 pci_dev->virtual_functions =3D g_new0(virPCIDeviceAddressPtr, naddress= es); @@ -1748,18 +1718,16 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContex= tPtr ctxt, addr =3D g_new0(virPCIDeviceAddress, 1); =20 if (virPCIDeviceAddressParseXML(addresses[i], addr) < 0) - goto cleanup; + return -1; =20 if (VIR_APPEND_ELEMENT(pci_dev->virtual_functions, pci_dev->num_virtual_functions, addr) < 0) - goto cleanup; + return -1; } =20 pci_dev->flags |=3D VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION; - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -1770,26 +1738,25 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr = ctxt, { g_autofree char *type =3D virXMLPropString(node, "type"); VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; =20 ctxt->node =3D node; =20 if (!type) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing capability type= ")); - goto cleanup; + return -1; } =20 if (STREQ(type, "phys_function") && virNodeDevPCICapSRIOVPhysicalParseXML(ctxt, pci_dev) < 0) { - goto cleanup; + return -1; } else if (STREQ(type, "virt_functions") && virNodeDevPCICapSRIOVVirtualParseXML(ctxt, pci_dev) < 0) { - goto cleanup; + return -1; } else if (STREQ(type, "mdev_types")) { if (virNodeDevCapMdevTypesParseXML(ctxt, &pci_dev->mdev_types, &pci_dev->nmdev_types) < 0) - goto cleanup; + return -1; pci_dev->flags |=3D VIR_NODE_DEV_CAP_FLAG_PCI_MDEV; } else { int hdrType =3D virPCIHeaderTypeFromString(type); @@ -1798,9 +1765,7 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ct= xt, pci_dev->hdrType =3D hdrType; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -1921,7 +1886,6 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSystemHardwarePtr hardware =3D &syscap->hardware; virNodeDevCapSystemFirmwarePtr firmware =3D &syscap->firmware; VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; g_autofree char *tmp =3D NULL; =20 ctxt->node =3D node; @@ -1936,22 +1900,20 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt, if (!tmp) { virReportError(VIR_ERR_INTERNAL_ERROR, _("no system UUID supplied for '%s'"), def->name); - goto out; + return -1; } =20 if (virUUIDParse(tmp, hardware->uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("malformed uuid element for '%s'"), def->name); - goto out; + return -1; } =20 firmware->vendor_name =3D virXPathString("string(./firmware/vendor[1]= )", ctxt); firmware->version =3D virXPathString("string(./firmware/version[1= ])", ctxt); firmware->release_date =3D virXPathString("string(./firmware/release_d= ate[1])", ctxt); =20 - ret =3D 0; - out: - return ret; + return 0; } =20 static int @@ -1983,7 +1945,6 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, virNodeDevCapMdevPtr mdev) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; int nattrs =3D 0; g_autofree xmlNodePtr *attrs =3D NULL; size_t i; @@ -1993,7 +1954,7 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, if (!(mdev->type =3D virXPathString("string(./type[1]/@id)", ctxt))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("missing type id attribute for '%s'"), def->name); - goto out; + return -1; } =20 /* 'iommuGroup' is optional, only report an error if the supplied valu= e is @@ -2003,18 +1964,16 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid iommuGroup number attribute for '%s'"), def->name); - goto out; + return -1; } =20 if ((nattrs =3D virXPathNodeSet("./attr", ctxt, &attrs)) < 0) - goto out; + return -1; =20 for (i =3D 0; i < nattrs; i++) virNodeDevCapMdevAttributeParseXML(ctxt, attrs[i], mdev); =20 - ret =3D 0; - out: - return ret; + return 0; } =20 =20 @@ -2529,7 +2488,6 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, g_autofree virNodeDevCapType *tmp =3D NULL; bool want_list =3D !!list; int ncaps =3D 0; - int ret =3D -1; =20 #define MAYBE_ADD_CAP(cap) \ do { \ @@ -2538,7 +2496,7 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, } while (0) =20 if (virNodeDeviceUpdateCaps(def) < 0) - goto cleanup; + return -1; =20 if (want_list) tmp =3D g_new0(virNodeDevCapType, VIR_NODE_DEV_CAP_LAST - 1); @@ -2596,9 +2554,8 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, =20 if (want_list) *list =3D g_steal_pointer(&tmp); - ret =3D ncaps; - cleanup: - return ret; + + return ncaps; } =20 =20 --=20 2.29.2