From nobody Sun Feb 8 05:07:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1605217765; cv=none; d=zohomail.com; s=zohoarc; b=AL8VzYkCFFf0iVGAKYWLGD73dJC5qnWHN1oNMn9NL6r4qA0kRord9DQWrfFLnWrMZtS5KzL9xLS9yYhxJic8WMHe22OmczlVpJNklK1Gumo7hiulxq7XxNYY/uV9wJp5haZhO4gNzgsxY1fhC3INHkL9GCewm87CQMd/rFhen5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605217765; h=Content-Type:Content-Transfer-Encoding:Cc: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=OUyZVlRykg/lSRaNqqWgXhOdGHSkSNI8BDGA3yr3hag=; b=Vl6euPPm5IK7z8dFP7THTEqkvsmGGQFUN5Pic91U+RKR9dD9pSToZUSQc0JOXxC5jbKius8hG+B3jmIDZcNByNS6npbMRG/F5C7KtXMOvAhPs151EKi6QzZ45XgeZiqq/9bFh88zCW351tujc1/LXtGe0acMR3T0eCOsUSdJsf0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605217765852668.1034703412249; Thu, 12 Nov 2020 13:49:25 -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-85-P1wRPMFPOfGv1p84TRMtVA-1; Thu, 12 Nov 2020 16:49:22 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 394EC1009E2F; Thu, 12 Nov 2020 21:49:15 +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 138B560C13; Thu, 12 Nov 2020 21:49:15 +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 D4CA5181A07B; Thu, 12 Nov 2020 21:49:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACLn8B3005524 for ; Thu, 12 Nov 2020 16:49:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 36EFF10711F; Thu, 12 Nov 2020 21:49:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 311E210711D for ; Thu, 12 Nov 2020 21:49:08 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 17BC81823603 for ; Thu, 12 Nov 2020 21:49:08 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-450-XCygfmZ1M7GeKkNvXcwK0Q-1; Thu, 12 Nov 2020 16:49:05 -0500 Received: by mail-qt1-f194.google.com with SMTP id n63so5291832qte.4 for ; Thu, 12 Nov 2020 13:49:05 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c7:b9cd:904e:d02:53c4:1c05]) by smtp.gmail.com with ESMTPSA id i15sm5136931qke.16.2020.11.12.13.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 13:49:04 -0800 (PST) X-MC-Unique: P1wRPMFPOfGv1p84TRMtVA-1 X-MC-Unique: XCygfmZ1M7GeKkNvXcwK0Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OUyZVlRykg/lSRaNqqWgXhOdGHSkSNI8BDGA3yr3hag=; b=ENiu9RTGNfO6gZwPAn6lWynXISgFIvScS/QzqF/UqotWbAgnNgg95JUZBnGMwkfJ5S qaI9Tpn1VKgtun5nL9B29wfYbX4i4VzY2BTrb5RZNMZn7SDMPaVL39QEtlvvw/tgyUKR MzqFdiqQDWZNNoxjTHGi6j+w6yEDcOOjncUK/hND3/myZ6voLL/5/6EQEfJF+rC5HLxq Zx/Ct77ukQzMNszMpMmAh29kHx54aUgIi0zT+hl43rwXpKZ7+SqAb2nQ26vCqBoPIvaS sXT9eCOHPmIR/lntqTsF00X+Zd5J1XRoRheakPMvDXhGqO3cnl1sbR6dXrj7XP03BO6N UXXA== X-Gm-Message-State: AOAM531AUapPPiLc930hd8ixUAT68dNwRHDjg8JenBdD1s4mJCvZG0yj g6hT+HaV/V+HCCXIVBUgi/AoUiz9jfw= X-Google-Smtp-Source: ABdhPJx34dls+dVdwT1zU+7MfpxSZ1OHM5JjmhRY4hfGjJJScvXlVUyPwyWdMwvWRu5s+yYaw8dusA== X-Received: by 2002:a05:622a:14e:: with SMTP id v14mr1323307qtw.298.1605217744794; Thu, 12 Nov 2020 13:49:04 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 10/10] qemu_domain.c: modernize qemuMonitorGetCpuHalted() Date: Thu, 12 Nov 2020 18:48:40 -0300 Message-Id: <20201112214840.636909-11-danielhb413@gmail.com> In-Reply-To: <20201112214840.636909-1-danielhb413@gmail.com> References: <20201112214840.636909-1-danielhb413@gmail.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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.12 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" Use g_autoptr() and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f28178af61..aea0a6bd93 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9217,9 +9217,8 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, virDomainVcpuDefPtr vcpu; qemuDomainVcpuPrivatePtr vcpupriv; size_t maxvcpus =3D virDomainDefGetVcpusMax(vm->def); - virBitmapPtr haltedmap =3D NULL; + g_autoptr(virBitmap) haltedmap =3D NULL; size_t i; - int ret =3D -1; bool fast; =20 /* Not supported currently for TCG, see qemuDomainRefreshVcpuInfo */ @@ -9244,7 +9243,7 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, haltedmap =3D qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcp= us, fast); if (qemuDomainObjExitMonitor(driver, vm) < 0 || !haltedmap) - goto cleanup; + return -1; =20 for (i =3D 0; i < maxvcpus; i++) { vcpu =3D virDomainDefGetVcpu(vm->def, i); @@ -9253,11 +9252,7 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, vcpup= riv->qemu_id)); } =20 - ret =3D 0; - - cleanup: - virBitmapFree(haltedmap); - return ret; + return 0; } =20 bool --=20 2.26.2