From nobody Sun Apr 28 22:57:15 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613616270; cv=none; d=zohomail.com; s=zohoarc; b=EmaQ6e81of2keIu4Bk/l0xoSHfeORtL3vgDXNRMNWZfFlmk2hR+qPNzm5M3k9xK45yibTslk5pvNbnhTqRpbbdgjHqCFAymGiuFxjflWJ6h+mDZPcVEQsDtH3Q/IMWRJ5FF+CL8RUKqeg+KMHW05/bM1NTbyZme/0HV5d/sr45g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613616270; h=Content-Type:Content-Transfer-Encoding:Cc: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=iopWOnpFxaMTW+zN13OHiYgzzwmiwjHkP/IpZdTxBvA=; b=RYk9j4ncdr5gqXGHBXh1X2Cj0ZDyOVWPr8VxPKrci/ad/9EBPUUP/gf7E328Ryiyf3rFx5MxfZ1c3+Uc/yi9kKgm+gX1qVntdsqHZhW1NSjfKNFnElVlNjss9tlC/wZbrFM6MlBZEDgYTZlvT7e0Z0Hl4JG+GVTfapDBULzkLLA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com 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 1613616269445129.92980771526413; Wed, 17 Feb 2021 18:44:29 -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-301-rEo6kM3wOu-HjqkXKFYc4g-1; Wed, 17 Feb 2021 21:44:26 -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 7BE63195D569; Thu, 18 Feb 2021 02:44:18 +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 48B135C730; Thu, 18 Feb 2021 02:44:17 +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 0CD9B4E58D; Thu, 18 Feb 2021 02:44:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11I2i8tf013819 for ; Wed, 17 Feb 2021 21:44:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id B213D202E941; Thu, 18 Feb 2021 02:44:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ABD832026D46 for ; Thu, 18 Feb 2021 02:44:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B3851022F09 for ; Thu, 18 Feb 2021 02:44:03 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.202]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-6LhrEpRbNh6KrcIx2S1xug-1; Wed, 17 Feb 2021 21:44:00 -0500 Received: from localhost (unknown [192.168.167.69]) by regular1.263xmail.com (Postfix) with ESMTP id 56B16740 for ; Thu, 18 Feb 2021 10:43:51 +0800 (CST) Received: from localhost.localdomain (unknown [120.230.93.149]) by smtp.263.net (postfix) whith ESMTP id P17138T139833569965824S1613616215628360_; Thu, 18 Feb 2021 10:43:47 +0800 (CST) X-MC-Unique: rEo6kM3wOu-HjqkXKFYc4g-1 X-MC-Unique: 6LhrEpRbNh6KrcIx2S1xug-1 X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-UNIQUE-TAG: <3f894ff157946bcf3b3985645fc6aba7> X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: jtomko@redhat.com X-SENDER-IP: 120.230.93.149 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Yi Li To: jtomko@redhat.com Subject: [PATCH] qemuBlockDiskDetectNodes: just return when alias is null Date: Thu, 18 Feb 2021 10:43:33 +0800 Message-Id: <20210218024333.8234-1-yili@winhong.com> In-Reply-To: <20210217165138.GG947916@lpt> References: <20210217165138.GG947916@lpt> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 11I2i8tf013819 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Yi Li 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 Content-Type: text/plain; charset="utf-8" Just return when alias is null and Remove the 'ret' variable. Signed-off-by: Yi Li Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_block.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 3d88e701b2..0af3e56c9a 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -280,25 +280,22 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, qemuBlockNodeNameBackingChainDataPtr entry =3D NULL; virStorageSourcePtr src =3D disk->src; g_autofree char *alias =3D NULL; - int ret =3D -1; =20 /* don't attempt the detection if the top level already has node names= */ if (src->nodeformat || src->nodestorage) return 0; =20 if (!(alias =3D qemuAliasDiskDriveFromDisk(disk))) - goto cleanup; + return -1; =20 - if (!(entry =3D virHashLookup(disktable, alias))) { - ret =3D 0; - goto cleanup; - } + if (!(entry =3D virHashLookup(disktable, alias))) + return 0; =20 while (virStorageSourceIsBacking(src) && entry) { if (src->nodeformat || src->nodestorage) { if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) || STRNEQ_NULLABLE(src->nodestorage, entry->nodestorage)) - goto cleanup; + goto error; =20 break; } else { @@ -310,13 +307,11 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, src =3D src->backingStore; } =20 - ret =3D 0; - - cleanup: - if (ret < 0) - qemuBlockDiskClearDetectedNodes(disk); + return 0; =20 - return ret; + error: + qemuBlockDiskClearDetectedNodes(disk); + return -1; } =20 =20 --=20 2.25.3