From nobody Mon Feb 9 10:32:24 2026 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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=1601628989; cv=none; d=zohomail.com; s=zohoarc; b=Qk7W0Dp0jEbbsYZfQnBV0zOwPXMfFom8bbZWS1z3x/WqsNiCwE2EJ7MVWNC3wjHYJxtOisL/QWUTsXDVS77mG9XiyxQd5LX6ZLTKBFj9v0Jh2txlWUHrMXVtX834ZTGjuFVQIYg0PSeAXIT8cwzgEzfn0/Tv3HAVGCEtFVr+xCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601628989; 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=TEdvMSplRfXhWI7IjQWYmU8KII3qWMRbD6st8EA3w9Y=; b=V0wLVClBzqKpmDfEn2LsCcsNfWtv4n4lvn4EbiT+HDwMk2JJSAZnWfcYifMpMQmlLJGVQSLvoyq2QCcHtVQhQavDCWIy7u7kgPCuUiZEzQIOFcJDsw2/y2hEx4eCjKtm4rR75gVe2aUj7iFSfgQ5SQSMurbus/HlaNrMwnah4to= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1601628989032460.49909234529184; Fri, 2 Oct 2020 01:56:29 -0700 (PDT) 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-52-JJqwuApwOfyN7ag70wUsMw-1; Fri, 02 Oct 2020 04:56:25 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 76148803F49; Fri, 2 Oct 2020 08:56: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 51ACF10023A5; Fri, 2 Oct 2020 08:56:18 +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 1D2F544A62; Fri, 2 Oct 2020 08:56:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0928uEd8014709 for ; Fri, 2 Oct 2020 04:56:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 376CB5C1DA; Fri, 2 Oct 2020 08:56:14 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9467D5C1D0 for ; Fri, 2 Oct 2020 08:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601628987; 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=TEdvMSplRfXhWI7IjQWYmU8KII3qWMRbD6st8EA3w9Y=; b=IEQmwFJn4wDjZmJmSTzyRK9FQKXgbIpDrToztqlgg2djEqHJGi2iyKY7hiFfmqf9tHHaZg OLyRShS8EE6Q8sUTuj/Uk+udlxRlnMy9UD/8Ky92ganjtRzOR7zbvqkUl9Q9FYIlND2UcJ bovSJkCxAp8D8sg4y94SWzYnAdhsHMM= X-MC-Unique: JJqwuApwOfyN7ag70wUsMw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/6] qemuDomainFilterHotplugVcpuEntities: Refactor memory freeing to remove 'cleanup' label Date: Fri, 2 Oct 2020 10:56:02 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.84 on 10.5.11.22 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) Content-Type: text/plain; charset="utf-8" After recent refactors the function can be refactored to remove the 'cleanup' label by using autoptr for the 'map' variable. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 82845736b1..dbaf3b7666 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6419,13 +6419,10 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr= def, { qemuDomainVcpuPrivatePtr vcpupriv; virDomainVcpuDefPtr vcpu; - virBitmapPtr map =3D NULL; - virBitmapPtr ret =3D NULL; + g_autoptr(virBitmap) map =3D virBitmapNewCopy(vcpus); ssize_t next =3D -1; size_t i; - map =3D virBitmapNewCopy(vcpus); - /* make sure that all selected vcpus are in the correct state */ while ((next =3D virBitmapNextSetBit(map, next)) >=3D 0) { if (!(vcpu =3D virDomainDefGetVcpu(def, next))) @@ -6434,13 +6431,13 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr= def, if (vcpu->online =3D=3D state) { virReportError(VIR_ERR_INVALID_ARG, _("vcpu '%zd' is already in requested state"), = next); - goto cleanup; + return NULL; } if (vcpu->online && !vcpu->hotpluggable) { virReportError(VIR_ERR_INVALID_ARG, _("vcpu '%zd' can't be hotunplugged"), next); - goto cleanup; + return NULL; } } @@ -6457,7 +6454,7 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr d= ef, virReportError(VIR_ERR_INVALID_ARG, _("vcpu '%zd' belongs to a larger hotpluggable = entity, " "but siblings were not selected"), next); - goto cleanup; + return NULL; } for (i =3D next + 1; i < next + vcpupriv->vcpus; i++) { @@ -6467,7 +6464,7 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr d= ef, "hotpluggable entity '%zd-%zd' which was " "partially selected"), i, next, next + vcpupriv->vcpus - 1); - goto cleanup; + return NULL; } /* clear the subthreads */ @@ -6475,11 +6472,7 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr = def, } } - ret =3D g_steal_pointer(&map); - - cleanup: - virBitmapFree(map); - return ret; + return g_steal_pointer(&map); } --=20 2.26.2