From nobody Sun Feb 8 21:11:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1639052398; cv=none; d=zohomail.com; s=zohoarc; b=PTP+fQv1MIzHEQSB4MdWmo4IgZXU88GZC5Z72+UdXJQmKYmnuTxy7Wby25ZPR2jw5xFr7modZvDYOjGTXzc3WIKcoqtbOKu5Z7D5JKUcNzMffRJG97A+JuGXeNif6nuZgw+q8sjp6TtnGsIA5tfP8PMGs+TqIRWvgZOFO8RbeMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639052398; 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=G9j5rL17Za0ERtPHvtn1fsjkwxcBRPjaLs1YVfK01Ug=; b=J72cZwjWsSgx8cx00jJF3JSYS7dCs5pn2m2OwNI6ZPZUlmD7aQX229Z8qlzK79ZnLaum6gXF36aTraA41bmStlHMJbue9C7GNNCWeH2mZ9OyYbjEgBZj7s0+qGVyC0/0QIw/Fd4Pe6wV6rkWR/yJs4xTfuyFuf4HChnLSLVuOk8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639052398304462.0246744188403; Thu, 9 Dec 2021 04:19:58 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-584-KqWicwiMNAyFrcBXJHvoLg-1; Thu, 09 Dec 2021 07:19:54 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2D06481EE74; Thu, 9 Dec 2021 12:19:48 +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 0F2EA17DBA; Thu, 9 Dec 2021 12:19:48 +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 D628F1805302; Thu, 9 Dec 2021 12:19:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B9CJi5c014006 for ; Thu, 9 Dec 2021 07:19:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9159B5ED32; Thu, 9 Dec 2021 12:19:44 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDB005ED36 for ; Thu, 9 Dec 2021 12:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639052397; 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=G9j5rL17Za0ERtPHvtn1fsjkwxcBRPjaLs1YVfK01Ug=; b=R7V0wIxN6mp22F5IE+RTeV9EAdwSrwAspTX3SxricskJzQT2ykZnPxrCBUCW0SkLiZoRtH PR5PZiGVxggwnScCfjXEN3VVjL1QHCmGesYXbQRAkL5+Hgu0w98H3S9ZwVNLiLeRKeskDf vMifDpSUJv/zr7OB6OV8QxwvK6R12ps= X-MC-Unique: KqWicwiMNAyFrcBXJHvoLg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/36] qemuProcessValidateHotpluggableVcpus: Refactor cleanup Date: Thu, 9 Dec 2021 13:18:16 +0100 Message-Id: <29c5b008d3ce98462ae14e72036c3fa99ef8cd7c.1639052248.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.14 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) X-ZM-MESSAGEID: 1639052400516100001 Content-Type: text/plain; charset="utf-8" Use automatic memory freeing for the temporary bitmap and remove the pointless 'cleanup' section. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_process.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6b83a571b9..804205131a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5954,8 +5954,7 @@ qemuProcessValidateHotpluggableVcpus(virDomainDef *de= f) unsigned int maxvcpus =3D virDomainDefGetVcpusMax(def); size_t i =3D 0; size_t j; - virBitmap *ordermap =3D virBitmapNew(maxvcpus + 1); - int ret =3D -1; + g_autoptr(virBitmap) ordermap =3D virBitmapNew(maxvcpus + 1); /* validate: * - all hotpluggable entities to be hotplugged have the correct data @@ -5974,14 +5973,14 @@ qemuProcessValidateHotpluggableVcpus(virDomainDef *= def) if (virBitmapIsBitSet(ordermap, vcpu->order)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("duplicate vcpu order '%u'"), vcpu->order= ); - goto cleanup; + return -1; } if (virBitmapSetBit(ordermap, vcpu->order)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("vcpu order '%u' exceeds vcpu count"), vcpu->order); - goto cleanup; + return -1; } } @@ -5993,7 +5992,7 @@ qemuProcessValidateHotpluggableVcpus(virDomainDef *de= f) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("vcpus '%zu' and '%zu' are in the same ho= tplug " "group but differ in configuration"), i, = j); - goto cleanup; + return -1; } } @@ -6003,15 +6002,12 @@ qemuProcessValidateHotpluggableVcpus(virDomainDef *= def) !vcpupriv->type) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("vcpu '%zu' is missing hotplug data"), i); - goto cleanup; + return -1; } } } - ret =3D 0; - cleanup: - virBitmapFree(ordermap); - return ret; + return 0; } --=20 2.31.1