From nobody Sun May 5 06:53:30 2024 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=1614788284; cv=none; d=zohomail.com; s=zohoarc; b=kjw5NpMiJz2EaPhDOzLtOeXN735T7H6XSVQBfTYmwbMjBTGeGOurEMYMNdMSvG4t5Za6+uLKCO5B9+ejyvqBXTr1uZVPH17QKnWQB8Ogpc/N9YuokteorNr/5rJx/EOazEKaMXPpy8vjpkgfEeIz6eVUnoj6OMFNjvo7uk3PqXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614788284; 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=58mygBK3JmXi4OIjYUbYNb2HfWlASuDwYnV3DAa8E6Y=; b=SKLGfk4mngAlFoh0bpkHcJvek/XJMOCSxWczLO40Cm4jdgXNG91gBe9Z6Tt/C0D5uR7KtMMO4gx+JOGZ0XJTC8fUohBs+1B48g4jv4eUA+EumY/2fAI5qCdohPurvTIfuwBxc74M5zNz7oML4VHFgV8+co+C9Rd9LDLex0HosLU= 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 1614788284583778.4315022274651; Wed, 3 Mar 2021 08:18:04 -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-358-AvmZAYrYMbqncYPx0xsQRg-1; Wed, 03 Mar 2021 11:17:57 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E83A195D562; Wed, 3 Mar 2021 16:17:52 +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 078FA5D705; Wed, 3 Mar 2021 16:17:52 +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 C1D7D4A7C6; Wed, 3 Mar 2021 16:17:51 +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 123GHomB020417 for ; Wed, 3 Mar 2021 11:17:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 733E76091B; Wed, 3 Mar 2021 16:17:50 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.195.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE061707B6 for ; Wed, 3 Mar 2021 16:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614788283; 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=58mygBK3JmXi4OIjYUbYNb2HfWlASuDwYnV3DAa8E6Y=; b=GfasAr7TqPCmDm0e3fwd8Fe8zAHB1VaJXf6fB5EA8ME9GFV7xYrBClb/vritObP6n0GgO9 daXRYFKszm/XQ2MYC2moqU5asxC7xOuD82/Ny8PqQhjUK1/woLsbpxyBVlbg50qXL09E0o rzp3/SHPO7ZVBC8cwDLB+2IUfwTA5Hg= X-MC-Unique: AvmZAYrYMbqncYPx0xsQRg-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 1/4] node_device_conf: Use g_autofree where possible Date: Wed, 3 Mar 2021 17:17:24 +0100 Message-Id: <27e2e67c37f88ba40408dd7f293293ddf1a6a33a.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.15 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 Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 76 +++++++++++-------------------------- 1 file changed, 23 insertions(+), 53 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 1093a461af..20fafd2c15 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -779,7 +779,7 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt, { VIR_XPATH_NODE_AUTORESTORE(ctxt) int ret =3D -1, val; - char *type =3D NULL; + g_autofree char *type =3D NULL; =20 ctxt->node =3D node; =20 @@ -795,7 +795,6 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt, ret =3D 0; =20 out: - VIR_FREE(type); return ret; } =20 @@ -807,7 +806,7 @@ virNodeDevCapMdevTypesParseXML(xmlXPathContextPtr ctxt, { int ret =3D -1; xmlNodePtr orignode =3D NULL; - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; int ntypes =3D -1; virMediatedDeviceTypePtr type =3D NULL; size_t i; @@ -859,7 +858,6 @@ virNodeDevCapMdevTypesParseXML(xmlXPathContextPtr ctxt, =20 ret =3D 0; cleanup: - VIR_FREE(nodes); virMediatedDeviceTypeFree(type); ctxt->node =3D orignode; return ret; @@ -1097,7 +1095,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virNodeDevCapStoragePtr storage) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; size_t i; int n, ret =3D -1; unsigned long long val; @@ -1122,7 +1120,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, goto out; =20 for (i =3D 0; i < n; i++) { - char *type =3D virXMLPropString(nodes[i], "type"); + g_autofree char *type =3D virXMLPropString(nodes[i], "type"); =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1150,7 +1148,6 @@ 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) { - VIR_FREE(type); goto out; } storage->removable_media_size =3D val; @@ -1160,11 +1157,8 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown storage capability type '%s' for '%s= '"), type, def->name); - VIR_FREE(type); goto out; } - - VIR_FREE(type); } =20 if (!(storage->flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE)) { @@ -1178,7 +1172,6 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, =20 ret =3D 0; out: - VIR_FREE(nodes); return ret; } =20 @@ -1233,7 +1226,7 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ct= xt, virNodeDevCapSCSITargetPtr scsi_target) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; int ret =3D -1, n =3D 0; size_t i; char *type =3D NULL; @@ -1295,7 +1288,6 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ct= xt, =20 out: VIR_FREE(type); - VIR_FREE(nodes); return ret; } =20 @@ -1309,7 +1301,7 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, const char *virt_type) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; int ret =3D -1, n =3D 0; size_t i; char *type =3D NULL; @@ -1397,7 +1389,6 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, =20 out: VIR_FREE(type); - VIR_FREE(nodes); return ret; } =20 @@ -1413,7 +1404,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, size_t i =3D -1; int ret =3D -1, n =3D -1; char *tmp =3D NULL; - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; =20 ctxt->node =3D node; =20 @@ -1472,7 +1463,6 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, =20 ret =3D 0; out: - VIR_FREE(nodes); VIR_FREE(tmp); return ret; } @@ -1595,8 +1585,8 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContext= Ptr ctxt, virNodeDevCapPCIDevPtr pci_dev) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr *addrNodes =3D NULL; - char *numberStr =3D NULL; + g_autofree xmlNodePtr *addrNodes =3D NULL; + g_autofree char *numberStr =3D NULL; int nAddrNodes, ret =3D -1; size_t i; virPCIDeviceAddressPtr pciAddr =3D NULL; @@ -1637,8 +1627,6 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContext= Ptr ctxt, =20 ret =3D 0; cleanup: - VIR_FREE(numberStr); - VIR_FREE(addrNodes); VIR_FREE(pciAddr); return ret; } @@ -1651,7 +1639,8 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt, { VIR_XPATH_NODE_AUTORESTORE(ctxt) int ret =3D -1, speed; - char *speedStr =3D NULL, *portStr =3D NULL; + g_autofree char *speedStr =3D NULL; + g_autofree char *portStr =3D NULL; =20 ctxt->node =3D linkNode; =20 @@ -1684,8 +1673,6 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt, =20 ret =3D 0; cleanup: - VIR_FREE(portStr); - VIR_FREE(speedStr); return ret; } =20 @@ -1752,9 +1739,9 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextP= tr ctxt, virNodeDevCapPCIDevPtr pci_dev) { int ret =3D -1; - xmlNodePtr *addresses =3D NULL; + g_autofree xmlNodePtr *addresses =3D NULL; int naddresses =3D virXPathNodeSet("./address", ctxt, &addresses); - char *maxFuncsStr =3D virXPathString("string(./@maxCount)", ctxt); + g_autofree char *maxFuncsStr =3D virXPathString("string(./@maxCount)",= ctxt); size_t i; =20 if (naddresses < 0) @@ -1787,8 +1774,6 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextP= tr ctxt, pci_dev->flags |=3D VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION; ret =3D 0; cleanup: - VIR_FREE(addresses); - VIR_FREE(maxFuncsStr); return ret; } =20 @@ -1798,7 +1783,7 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ct= xt, xmlNodePtr node, virNodeDevCapPCIDevPtr pci_dev) { - char *type =3D virXMLPropString(node, "type"); + g_autofree char *type =3D virXMLPropString(node, "type"); VIR_XPATH_NODE_AUTORESTORE(ctxt) int ret =3D -1; =20 @@ -1830,7 +1815,6 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ct= xt, =20 ret =3D 0; cleanup: - VIR_FREE(type); return ret; } =20 @@ -1844,11 +1828,11 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt, VIR_XPATH_NODE_AUTORESTORE(ctxt) xmlNodePtr iommuGroupNode; xmlNodePtr pciExpress; - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; int n =3D 0; int ret =3D -1; virPCIEDeviceInfoPtr pci_express =3D NULL; - char *tmp =3D NULL; + g_autofree char *tmp =3D NULL; size_t i =3D 0; =20 ctxt->node =3D node; @@ -1860,7 +1844,6 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt, _("invalid PCI class supplied for '%s'"), def->= name); goto out; } - VIR_FREE(tmp); } else { pci_dev->klass =3D -1; } @@ -1911,7 +1894,6 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt, if (virNodeDevPCICapabilityParseXML(ctxt, nodes[i], pci_dev) < 0) goto out; } - VIR_FREE(nodes); =20 if ((iommuGroupNode =3D virXPathNode("./iommuGroup[1]", ctxt))) { if (virNodeDevCapPCIDevIommuGroupParseXML(ctxt, iommuGroupNode, @@ -1940,8 +1922,6 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt, =20 ret =3D 0; out: - VIR_FREE(nodes); - VIR_FREE(tmp); virPCIEDeviceInfoFree(pci_express); return ret; } @@ -1957,7 +1937,7 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSystemFirmwarePtr firmware =3D &syscap->firmware; VIR_XPATH_NODE_AUTORESTORE(ctxt) int ret =3D -1; - char *tmp; + g_autofree char *tmp =3D NULL; =20 ctxt->node =3D node; =20 @@ -1977,10 +1957,8 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt, if (virUUIDParse(tmp, hardware->uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("malformed uuid element for '%s'"), def->name); - VIR_FREE(tmp); goto out; } - VIR_FREE(tmp); =20 firmware->vendor_name =3D virXPathString("string(./firmware/vendor[1]= )", ctxt); firmware->version =3D virXPathString("string(./firmware/version[1= ])", ctxt); @@ -2063,7 +2041,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, const char *virt_type) { virNodeDevCapsDefPtr caps; - char *tmp; + g_autofree char *tmp =3D NULL; int val, ret =3D -1; =20 caps =3D g_new0(virNodeDevCapsDef, 1); @@ -2078,11 +2056,9 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, if ((val =3D virNodeDevCapTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown capability type '%s'"), tmp); - VIR_FREE(tmp); goto error; } caps->data.type =3D val; - VIR_FREE(tmp); =20 switch (caps->data.type) { case VIR_NODE_DEV_CAP_SYSTEM: @@ -2198,7 +2174,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, =20 for (i =3D 0, m =3D 0; i < n; i++) { xmlNodePtr node =3D nodes[i]; - char *tmp =3D virXMLPropString(node, "type"); + g_autofree char *tmp =3D virXMLPropString(node, "type"); int val; =20 if (!tmp) { @@ -2212,10 +2188,8 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, if (val < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown devnode type '%s'"), tmp); - VIR_FREE(tmp); goto error; } - VIR_FREE(tmp); =20 switch ((virNodeDevDevnodeType)val) { case VIR_NODE_DEV_DEVNODE_DEV: @@ -2567,7 +2541,7 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, virNodeDevCapType **list) { virNodeDevCapsDefPtr caps =3D NULL; - virNodeDevCapType *tmp =3D NULL; + g_autofree virNodeDevCapType *tmp =3D NULL; bool want_list =3D !!list; int ncaps =3D 0; int ret =3D -1; @@ -2639,7 +2613,6 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, *list =3D g_steal_pointer(&tmp); ret =3D ncaps; cleanup: - VIR_FREE(tmp); return ret; } =20 @@ -2649,7 +2622,7 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, int virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host) { - char *tmp =3D NULL; + g_autofree char *tmp =3D NULL; int ret =3D -1; =20 if ((scsi_host->unique_id =3D @@ -2698,7 +2671,6 @@ virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr= scsi_host) goto cleanup; } =20 - VIR_FREE(tmp); if (!(tmp =3D virVHBAGetConfig(NULL, scsi_host->host, "npiv_vports_inuse"))) { VIR_WARN("Failed to read npiv_vports_inuse for host%d", @@ -2723,7 +2695,6 @@ virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr= scsi_host) VIR_FREE(scsi_host->wwpn); VIR_FREE(scsi_host->fabric_wwn); } - VIR_FREE(tmp); return ret; } =20 @@ -2733,7 +2704,8 @@ virNodeDeviceGetSCSITargetCaps(const char *sysfsPath, virNodeDevCapSCSITargetPtr scsi_target) { int ret =3D -1; - char *dir =3D NULL, *rport =3D NULL; + g_autofree char *dir =3D NULL; + g_autofree char *rport =3D NULL; =20 VIR_DEBUG("Checking if '%s' is an FC remote port", scsi_target->name); =20 @@ -2763,8 +2735,6 @@ virNodeDeviceGetSCSITargetCaps(const char *sysfsPath, VIR_FREE(scsi_target->wwpn); scsi_target->flags &=3D ~VIR_NODE_DEV_CAP_FLAG_FC_RPORT; } - VIR_FREE(rport); - VIR_FREE(dir); =20 return ret; } --=20 2.29.2 From nobody Sun May 5 06:53:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1614788291; cv=none; d=zohomail.com; s=zohoarc; b=iE46AML122yM8EmcBj3WR0KyBOQZMt8QFCFmdGtl0oaE08qxuXNzIKFm7IFaOOBl2BKwFwpf6pqjSGAs4cVZVkj1rG6VWNrnNH3aUJhWXNFe5WjgzsK1fnk4SuO1q9zc1hBx/UKoTQV0lcePeyLNKDsrBBMJrVApU4/CCa+vjy4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614788291; 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=cdeXDsRQ1xpv8OjCMgYp1zKy2PAjVPvDwiH33NlMMz0=; b=W2CR0OxCjk6mVpZJxg37I6yJ2iLkfoXktHWqGz5ESDMoSjYW0iyFxs1e/RUxHMByMDFzloBg9nrPpivsrv2vorVQ8FvMfFdhrMLuvfqE34cBbRL/7FlGK48LIJD4UEsnvK3u53mVXcm7aXMfZdZsb7d5nyQDrIhnEN3rAs4cl7I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614788291202763.0740330926499; Wed, 3 Mar 2021 08:18:11 -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-575-MC8pqaVKMP6S5Fqcdy0JZQ-1; Wed, 03 Mar 2021 11:18:07 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 400F9106BB42; Wed, 3 Mar 2021 16:18:01 +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 1DD355D749; Wed, 3 Mar 2021 16:18:01 +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 D38275002E; Wed, 3 Mar 2021 16:18:00 +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 123GHxq7020451 for ; Wed, 3 Mar 2021 11:17:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2849D6091B; Wed, 3 Mar 2021 16:17:59 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.195.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B50070953 for ; Wed, 3 Mar 2021 16:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614788290; 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=cdeXDsRQ1xpv8OjCMgYp1zKy2PAjVPvDwiH33NlMMz0=; b=a4RDMTo04yKYpjGZCiauOt8UHhAUVgoR1iDAxlPN98T1DNItZGIuH6LOElPsn8Z+OvrxvA iOPudLRn3tdxq5xzd3FTFZglD6wJOyyKHgkAjPmBJRA/N8JCUVghISHJWsv1XjeJIFn8Gp 9o5mzh1nGn22VebojXozmpOWxaqp5Nc= X-MC-Unique: MC8pqaVKMP6S5Fqcdy0JZQ-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 2/4] node_device_conf: Refactoring functions in order to remove VIR_FREE Date: Wed, 3 Mar 2021 17:17:25 +0100 Message-Id: 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.15 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" By: * declaration of an autofreed variable in for loop * use of a new variable * removal of VIR_FREE Signed-off-by: Kristina Hanicova Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 20fafd2c15..cfc72299de 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1229,7 +1229,6 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ct= xt, g_autofree xmlNodePtr *nodes =3D NULL; int ret =3D -1, n =3D 0; size_t i; - char *type =3D NULL; =20 ctxt->node =3D node; =20 @@ -1245,6 +1244,7 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ct= xt, goto out; =20 for (i =3D 0; i < n; ++i) { + g_autofree char *type =3D NULL; type =3D virXMLPropString(nodes[i], "type"); =20 if (!type) { @@ -1280,14 +1280,11 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr = ctxt, type, def->name); goto out; } - - VIR_FREE(type); } =20 ret =3D 0; =20 out: - VIR_FREE(type); return ret; } =20 @@ -1304,7 +1301,6 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, g_autofree xmlNodePtr *nodes =3D NULL; int ret =3D -1, n =3D 0; size_t i; - char *type =3D NULL; =20 ctxt->node =3D node; =20 @@ -1328,6 +1324,7 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, goto out; =20 for (i =3D 0; i < n; i++) { + g_autofree char *type =3D NULL; type =3D virXMLPropString(nodes[i], "type"); =20 if (!type) { @@ -1381,14 +1378,11 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ct= xt, type, def->name); goto out; } - - VIR_FREE(type); } =20 ret =3D 0; =20 out: - VIR_FREE(type); return ret; } =20 @@ -1403,7 +1397,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, xmlNodePtr lnk; size_t i =3D -1; int ret =3D -1, n =3D -1; - char *tmp =3D NULL; + g_autofree char *type =3D NULL; g_autofree xmlNodePtr *nodes =3D NULL; =20 ctxt->node =3D node; @@ -1425,6 +1419,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, net->features =3D virBitmapNew(VIR_NET_DEV_FEAT_LAST); =20 for (i =3D 0; i < n; i++) { + g_autofree char *tmp =3D NULL; int val; if (!(tmp =3D virXMLPropString(nodes[i], "name"))) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -1439,15 +1434,13 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, goto out; } ignore_value(virBitmapSetBit(net->features, val)); - VIR_FREE(tmp); } =20 net->subtype =3D VIR_NODE_DEV_CAP_NET_LAST; =20 - tmp =3D virXPathString("string(./capability/@type)", ctxt); - if (tmp) { - int val =3D virNodeDevNetCapTypeFromString(tmp); - VIR_FREE(tmp); + type =3D virXPathString("string(./capability/@type)", ctxt); + if (type) { + int val =3D virNodeDevNetCapTypeFromString(type); if (val < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid network type supplied for '%s'"), @@ -1463,7 +1456,6 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, =20 ret =3D 0; out: - VIR_FREE(tmp); return ret; } =20 --=20 2.29.2 From nobody Sun May 5 06:53:30 2024 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=1614788293; cv=none; d=zohomail.com; s=zohoarc; b=E1uhd+45ICoC3SPHL/r5lZTKfx440g0lBrglvAsFAZoIkmAe67bv/3jnZy+YH/0UxLiRDzbg5LYRXPdSBj2BTpnBxoywNJKZuGEcrR9Yo49fonsBsxzx+sU2PPj3sRCbrcBnttuDg6N3244ztt7TDupV+wzvmRdG/+lfdV7zR7I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614788293; 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=3hj9l9whXoDHx4jZCUU2QWcohMGWstyuvV2Rjb4Pskw=; b=ET2oaPa1LrBzZ+mXRXnjxxtGa1VzXODF/gPzPS0KuNiS1n6vGrKVdZBy4syOfrMytSdzsYuNIn6/6P0hXvtbeKEm7CZPpzohV9ScWsLInL5jOXi1ZYCUp21dxW99aVR/ZvqSQ1ZoDSh+o1EVzKE2oymNDMHLUiagV2wrBvqoDOQ= 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 1614788293987391.3254613418958; Wed, 3 Mar 2021 08:18:13 -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-360-qSGfqdlJN06-_GTL9tbBgA-1; Wed, 03 Mar 2021 11:18:09 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C898587498B; Wed, 3 Mar 2021 16:18:03 +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 A041658821; Wed, 3 Mar 2021 16:18:03 +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 2EA0A50031; Wed, 3 Mar 2021 16:18:03 +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 123GI1sK020467 for ; Wed, 3 Mar 2021 11:18:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1B1F1226EE; Wed, 3 Mar 2021 16:18:01 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.195.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 769C76091B for ; Wed, 3 Mar 2021 16:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614788292; 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=3hj9l9whXoDHx4jZCUU2QWcohMGWstyuvV2Rjb4Pskw=; b=fdvgdyYUBtLyLXHvjvbaKgStE0akbVn+hB8LmSGBeIBDOCEBl4e7VrpbIHHkWhQ5m31xsY sJvauYwU/bhr0Oh7H9RU+064tgqC1NMPyHVvVwg6wF73BCoBAsjCuMndnf8URbMRpE9ry2 EGGP4hQip7QX5tW34nnqy3n+/EL+EIg= X-MC-Unique: qSGfqdlJN06-_GTL9tbBgA-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 3/4] node_device_conf: use g_autoptr in virNodeDevCapPCIDevIommuGroupParseXML() Date: Wed, 3 Mar 2021 17:17:26 +0100 Message-Id: <16e8b522c723a8fd0a000b7a688ea4cb70d8db0d.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.16 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 Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index cfc72299de..a64be74011 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1581,7 +1581,6 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContext= Ptr ctxt, g_autofree char *numberStr =3D NULL; int nAddrNodes, ret =3D -1; size_t i; - virPCIDeviceAddressPtr pciAddr =3D NULL; =20 ctxt->node =3D iommuGroupNode; =20 @@ -1603,14 +1602,9 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContex= tPtr ctxt, goto cleanup; =20 for (i =3D 0; i < nAddrNodes; i++) { - virPCIDeviceAddress addr =3D {0}; - if (virPCIDeviceAddressParseXML(addrNodes[i], &addr) < 0) - goto cleanup; - pciAddr =3D g_new0(virPCIDeviceAddress, 1); - pciAddr->domain =3D addr.domain; - pciAddr->bus =3D addr.bus; - pciAddr->slot =3D addr.slot; - pciAddr->function =3D addr.function; + g_autoptr(virPCIDeviceAddress) pciAddr =3D g_new0(virPCIDeviceAddr= ess, 1); + if (virPCIDeviceAddressParseXML(addrNodes[i], pciAddr) < 0) + return -1; if (VIR_APPEND_ELEMENT(pci_dev->iommuGroupDevices, pci_dev->nIommuGroupDevices, pciAddr) < 0) @@ -1619,7 +1613,6 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContext= Ptr ctxt, =20 ret =3D 0; cleanup: - VIR_FREE(pciAddr); return ret; } =20 --=20 2.29.2 From nobody Sun May 5 06:53:30 2024 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 Reviewed-by: Michal Privoznik --- 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