From nobody Sun Feb 8 23:26:50 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=1639052396; cv=none; d=zohomail.com; s=zohoarc; b=Tyj2kNUlaIQmIGsnO7DrNh/iiV88hFZPddXb+MRClNMqWs36DHralB7Sljfkrzb6ds31DK2cdvC0E4BrzPa/luzms3mxzIQ948p4EQoZWkT4qXa2O11jNRHawQnlUkNPwJvrLB8muiTe1Mkv/WM+mayb0rSXMYKOEOe7TNhscxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639052396; 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=KZaVBOWqypHTTgcNQn9HCUllj10neIVxiUNhNaeDyMs=; b=Ui21/A9Bkskv6FmBpvSw0Ee/07ifKb9BpTFHJw/8xcgfnzjP0QwS/0+xKF9mNgXCyUGTDP9J+3VeFKBHISmcD2v2+xrkIDG1wPKsV+saetW7H+tT58QX76EjSf5rs8Ov//29nLa1BaKS1rW9aGXfLqZyK8Hdn0YvbnDRGiIpfxQ= 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 1639052396575510.04649811836; Thu, 9 Dec 2021 04:19:56 -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-520-zNGJ7vT0P6CPCG70BUzPyQ-1; Thu, 09 Dec 2021 07:19:52 -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 98F3F193F588; Thu, 9 Dec 2021 12:19:44 +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 38D0C45D72; Thu, 9 Dec 2021 12:19:44 +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 0EC4F1806D2D; Thu, 9 Dec 2021 12:19:44 +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 1B9CJfOr013970 for ; Thu, 9 Dec 2021 07:19:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5CE2C5ED32; Thu, 9 Dec 2021 12:19:41 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id B30195ED2B for ; Thu, 9 Dec 2021 12:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639052395; 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=KZaVBOWqypHTTgcNQn9HCUllj10neIVxiUNhNaeDyMs=; b=N8TrVMzr+a51z5+1Ph7T7MJWFa2xg+gFrriWZMl5OEFTteMSKbKDdEEPuPobbBxOlabea2 VVWtj8luBT3ouPOsKSbBOlhm0kRbwKVl27D/rQJ4qW3/Jt39u2TvfdQ8z+Nzan6uyDCQNE c0HxiBSUVXPAhtff1JT0u3CJ7EBS8NQ= X-MC-Unique: zNGJ7vT0P6CPCG70BUzPyQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/36] qemuDomainSelectHotplugVcpuEntities: Refactor cleanup Date: Thu, 9 Dec 2021 13:18:13 +0100 Message-Id: <596f77014f332de51a928b2452c32dc103876c1e.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: 1639052398222100007 Content-Type: text/plain; charset="utf-8" Use automatic memory freeing for the 'ret' bitmap and remove the pointless 'cleanup' section. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 2e1d18c633..f307420ac1 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6473,7 +6473,7 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDef *def, unsigned int nvcpus, bool *enable) { - virBitmap *ret =3D NULL; + g_autoptr(virBitmap) ret =3D NULL; virDomainVcpuDef *vcpu; qemuDomainVcpuPrivate *vcpupriv; unsigned int maxvcpus =3D virDomainDefGetVcpusMax(def); @@ -6501,7 +6501,7 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDef *def, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("target vm vcpu granularity does not allo= w the " "desired vcpu count")); - goto error; + return NULL; } ignore_value(virBitmapSetBit(ret, i)); @@ -6528,7 +6528,7 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDef *def, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("target vm vcpu granularity does not allo= w the " "desired vcpu count")); - goto error; + return NULL; } ignore_value(virBitmapSetBit(ret, i)); @@ -6539,14 +6539,10 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDef *d= ef, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("failed to find appropriate hotpluggable vcpus to= " "reach the desired target vcpu count")); - goto error; + return NULL; } - return ret; - - error: - virBitmapFree(ret); - return NULL; + return g_steal_pointer(&ret); } --=20 2.31.1