From nobody Mon Feb 9 10:33:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 158195967594953.55981430405939; Mon, 17 Feb 2020 09:14:35 -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-144-4w-nLs7FOc2zfgsjfz4XJw-1; Mon, 17 Feb 2020 12:14:32 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCECE800D53; Mon, 17 Feb 2020 17:14:25 +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 913A61001B28; Mon, 17 Feb 2020 17:14: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 4485635B09; Mon, 17 Feb 2020 17:14:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01HHEB5u018725 for ; Mon, 17 Feb 2020 12:14:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 78A6A10021B2; Mon, 17 Feb 2020 17:14:11 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id F352C10001AE for ; Mon, 17 Feb 2020 17:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581959674; 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=w2b4zDQMDVMr7ujp+OQtMubn1VogZM/1S19gkdE3tTY=; b=emCLh8YAaRKGGVC4afv6JE4YW9jrYqt2zAaDXdQOyJRmwiJeBAhDlcPrGR0VC3i5bK3vwn /LKShcwr8qQ4USsMDeI/ohaVHLuWocsUsA0lmw2n5difL82sE342EXcqe2PxDldtD4tHFm 5QbuyBdOgtIi4OaueB0IFAY5lD71SHg= From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/9] virStorageFileGetMetadataRecurse: Remove 'cleanup' label Date: Mon, 17 Feb 2020 18:13:57 +0100 Message-Id: <1e828b5156ca15b23f1faeb5441225dc71a80561.1581959449.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.84 on 10.5.11.22 X-MC-Unique: 4w-nLs7FOc2zfgsjfz4XJw-1 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" There's nothing to clean up. Make it obvious what is returned. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/util/virstoragefile.c | 50 +++++++++++++++------------------------ 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 1e21d44c67..b984204b93 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -5010,7 +5010,6 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, virHashTablePtr cycle, unsigned int depth) { - int ret =3D -1; size_t headerLen; int backingFormat; int rv; @@ -5030,19 +5029,16 @@ virStorageFileGetMetadataRecurse(virStorageSourcePt= r src, &buf, &headerLen, cycle= ) < 0) return -1; - if (virStorageFileGetMetadataInternal(src, buf, headerLen, - &backingFormat) < 0) - goto cleanup; + if (virStorageFileGetMetadataInternal(src, buf, headerLen, &backingFor= mat) < 0) + return -1; if (src->backingStoreRaw) { if ((rv =3D virStorageSourceNewFromBacking(src, &backingStore)) < = 0) - goto cleanup; + return -1; - if (rv =3D=3D 1) { - /* the backing file would not be usable for VM usage */ - ret =3D 0; - goto cleanup; - } + /* the backing file would not be usable for VM usage */ + if (rv =3D=3D 1) + return 0; backingStore->format =3D backingFormat; @@ -5065,17 +5061,14 @@ virStorageFileGetMetadataRecurse(virStorageSourcePt= r src, if (backingStore->format =3D=3D VIR_STORAGE_FILE_AUTO_SAFE) backingStore->format =3D VIR_STORAGE_FILE_AUTO; - if ((ret =3D virStorageFileGetMetadataRecurse(backingStore, parent, - uid, gid, - report_broken, - cycle, depth + 1)) < 0= ) { + if (virStorageFileGetMetadataRecurse(backingStore, parent, + uid, gid, + report_broken, + cycle, depth + 1) < 0) { if (report_broken) - goto cleanup; - - /* if we fail somewhere midway, just accept and return a - * broken chain */ - ret =3D 0; - goto cleanup; + return -1; + else + return 0; } backingStore->id =3D depth; @@ -5083,7 +5076,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, } else { /* add terminator */ if (!(src->backingStore =3D virStorageSourceNew())) - goto cleanup; + return -1; } if (src->externalDataStoreRaw) { @@ -5091,21 +5084,16 @@ virStorageFileGetMetadataRecurse(virStorageSourcePt= r src, if ((rv =3D virStorageSourceNewFromExternalData(src, &externalDataStore))= < 0) - goto cleanup; + return -1; - if (rv =3D=3D 1) { - /* the file would not be usable for VM usage */ - ret =3D 0; - goto cleanup; - } + /* the file would not be usable for VM usage */ + if (rv =3D=3D 1) + return 0; src->externalDataStore =3D g_steal_pointer(&externalDataStore); } - ret =3D 0; - - cleanup: - return ret; + return 0; } --=20 2.24.1