From nobody Mon Feb 9 12:29:12 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=1639052395; cv=none; d=zohomail.com; s=zohoarc; b=gH7gKjvFuGoJfuICXAbz5JGoX/DrE40jvgzsEpmIEJKwXLVoH9roxvdcOz4Ifp7fObfItweDYIuqUoEocTEHLBgoJyVWWdxC7rQ9bdSjeoYmk7zswW0GqlSsZCZw6cxSomahVgrbkokLjZ4HlJ+lSwCIZBscPyfBJT6bvNY+1zY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639052395; 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=Q4mxLxsWj/uKAAd4kt/rEPdCmf5OJFRaf3Jdt3IPum0=; b=FjuoO0rNXZ54iU0WpLzUaespW/D62nlbM+ehjpb6Ku/bJx6Cmry3c3X1xgDL2B+JBIqx0ej3AZWss/dcA6bA2jKz+slcTwbXX80099Gydth6Q8x2Qk4SNWZwIQoZNyo6clvY5WE8Rv4uUCXD4Ft18DembmYQq3Jr1irbuWZ4IQ8= 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 1639052395434584.7904212997877; Thu, 9 Dec 2021 04:19:55 -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-142-0RCmsp7TPWWEd6HgmLmXJw-1; Thu, 09 Dec 2021 07:19:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9F721575A; Thu, 9 Dec 2021 12:19:45 +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 A7D2967846; Thu, 9 Dec 2021 12:19:45 +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 756281806D2E; Thu, 9 Dec 2021 12:19:45 +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 1B9CJgQC013976 for ; Thu, 9 Dec 2021 07:19:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 705B35ED32; Thu, 9 Dec 2021 12:19:42 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCA585ED2B for ; Thu, 9 Dec 2021 12:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639052394; 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=Q4mxLxsWj/uKAAd4kt/rEPdCmf5OJFRaf3Jdt3IPum0=; b=LosAUbaf3tMLuXIR+Mw/9bXWdJrAfdX0GxZcOjzODzjMUYO5SjTFyG9xMRi6WWZOAMOINC L3tB3Xy/pRZn/KWdtgkNqrpPSO0nLCBPLtrtyC6e6TIZ3c/bIAp3m7LmbVQUEVw04AgGD2 ByIzOalFa4R5lxNWlO5fI3quFRW4wRw= X-MC-Unique: 0RCmsp7TPWWEd6HgmLmXJw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/36] qemuDomainSetVcpusInternal: Refactor cleanup Date: Thu, 9 Dec 2021 13:18:14 +0100 Message-Id: <9f0adb966a87c115f0973c5c38dad18b0e051ad1.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.11 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: 1639052396044100003 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_hotplug.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f307420ac1..b4c8536b47 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6665,16 +6665,15 @@ qemuDomainSetVcpusInternal(virQEMUDriver *driver, bool hotpluggable) { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - virBitmap *vcpumap =3D NULL; + g_autoptr(virBitmap) vcpumap =3D NULL; bool enable; - int ret =3D -1; if (def && nvcpus > virDomainDefGetVcpusMax(def)) { virReportError(VIR_ERR_INVALID_ARG, _("requested vcpus is greater than max allowable" " vcpus for the live domain: %u > %u"), nvcpus, virDomainDefGetVcpusMax(def)); - goto cleanup; + return -1; } if (persistentDef && nvcpus > virDomainDefGetVcpusMax(persistentDef)) { @@ -6682,30 +6681,26 @@ qemuDomainSetVcpusInternal(virQEMUDriver *driver, _("requested vcpus is greater than max allowable" " vcpus for the persistent domain: %u > %u"), nvcpus, virDomainDefGetVcpusMax(persistentDef)); - goto cleanup; + return -1; } if (def) { if (!(vcpumap =3D qemuDomainSelectHotplugVcpuEntities(vm->def, nvc= pus, &enable))) - goto cleanup; + return -1; if (qemuDomainSetVcpusLive(driver, cfg, vm, vcpumap, enable) < 0) - goto cleanup; + return -1; } if (persistentDef) { qemuDomainSetVcpusConfig(persistentDef, nvcpus, hotpluggable); if (virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir= ) < 0) - goto cleanup; + return -1; } - ret =3D 0; - - cleanup: - virBitmapFree(vcpumap); - return ret; + return 0; } --=20 2.31.1