From nobody Mon May 6 02:52:02 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; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612428182; cv=none; d=zohomail.com; s=zohoarc; b=CUlk2cVTXalKgpr3LPCXvdkGF3wtAKOOoTrHlJ48cCnCDqhFaJCfaNkufAiRyFdx23DbKFI0+BmLr65gIWYbTVUognhJjPORM924Xo/58Bch2VmRK6s233p1N0WlgmLEAuDzJBH3J6aC6mpwEoqDEmYCq9/4TM4bO8rQvCBPn6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612428182; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ArUmn6xTW51CKwrnaeh6U+HhYqZcvr/E2P36206+gd4=; b=Igg80v7q29VffTvlwyeNXIaJOf40t5+c6/raip18KLZH9/z2MVthMRzmIE5zDdJGdk+p8KXIlDcCMegw6IqflXzUqKI8w4hu3WCps4JYO5en4s1kV7WOERtKRprGdxfKVQ3TgsvGzkHKfNYMvP9dAHkHwUXJyutN1p+7egfX9WU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1612428181948476.3177481266812; Thu, 4 Feb 2021 00:43:01 -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-340-EnA8HHDQN7WStZmSHQvwAQ-1; Thu, 04 Feb 2021 03:42:58 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DD85100CCC2; Thu, 4 Feb 2021 08:42: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 000CA194A4; Thu, 4 Feb 2021 08:42:51 +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 402EF4E58D; Thu, 4 Feb 2021 08:42:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1148gmpd014290 for ; Thu, 4 Feb 2021 03:42:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3099A2166B2F; Thu, 4 Feb 2021 08:42:48 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 29E792166B2E for ; Thu, 4 Feb 2021 08:42:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 7562D8011B6 for ; Thu, 4 Feb 2021 08:42:42 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-407-Pm4RBeWeOiu48U-iylQW8A-1; Thu, 04 Feb 2021 03:42:39 -0500 Received: from localhost (unknown [192.168.167.69]) by regular1.263xmail.com (Postfix) with ESMTP id 0D0401DBD for ; Thu, 4 Feb 2021 16:42:34 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.70]) by smtp.263.net (postfix) whith ESMTP id P17144T139833401906944S1612428147500956_; Thu, 04 Feb 2021 16:42:33 +0800 (CST) X-MC-Unique: EnA8HHDQN7WStZmSHQvwAQ-1 X-MC-Unique: Pm4RBeWeOiu48U-iylQW8A-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-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: libvir-list@redhat.com X-SENDER-IP: 14.18.236.70 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Yi Li To: libvir-list@redhat.com Subject: [PATCH] qemuBlockDiskDetectNodes: just return when alias is null Date: Thu, 4 Feb 2021 16:42:26 +0800 Message-Id: <20210204084226.1568632-1-yili@winhong.com> 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.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1148gmpd014290 X-loop: libvir-list@redhat.com Cc: 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.84 on 10.5.11.23 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 --- 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 0b8ca2a3f5..32b6500a3d 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 0; =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