From nobody Sun Feb 8 06:54:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1595020798; cv=none; d=zohomail.com; s=zohoarc; b=ksWaM2wsqMbgWigks5+oGNHAUABWoRYJTXWvCSYD+cZAmBfwh68D6qqkUxx+K1ITtnJkii5x1vImD6ZFXPYMbGVt7caUNiZwOBR717vD1W5FQRRmVvO2yDkAM6u1WhQm+ffO1bfjImbIEg7J1fsrCO5RbykRNrYcSvmedxe3N+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595020798; 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=HxCOILoaySTp7nfWTlLVxn/PTvqCZPDEfwq3vzxRgZ0=; b=TaJJ3zC1WH/Abuyq04UMkAmRtSCmI1JH1w6PmwUTfQVAb0ZVhWIAdPuuZjuyoVKxEHJcVZWFa+RIPX1DNaBJceF6WfNxOOoK5IKow6R/v+JCXDlw2laXh0ASYgl36Mxg1Gd7DtpSAhQ7pFD0TNnKv3GirIDoxiYHcJ9Cb+arn7Q= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1595020798852232.8183110686216; Fri, 17 Jul 2020 14:19:58 -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-298-mWz9RT_fPn6GtN-0mD3PhQ-1; Fri, 17 Jul 2020 17:19:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACE041080; Fri, 17 Jul 2020 21:19:49 +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 8981F5C1D4; Fri, 17 Jul 2020 21:19:49 +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 55A2F1809557; Fri, 17 Jul 2020 21:19:49 +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 06HLGDib019530 for ; Fri, 17 Jul 2020 17:16:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5BB3A11410C; Fri, 17 Jul 2020 21:16:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 572D4114108 for ; Fri, 17 Jul 2020 21:16:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 7666080CC2C for ; Fri, 17 Jul 2020 21:16:12 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-211-Fv1X8Ta-OiupxlGKsBuVAA-1; Fri, 17 Jul 2020 17:16:10 -0400 Received: by mail-qt1-f195.google.com with SMTP id a32so8727050qtb.5 for ; Fri, 17 Jul 2020 14:16:10 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:9447:1f8b:580e:61d9:b1a4]) by smtp.gmail.com with ESMTPSA id x19sm11847162qtc.36.2020.07.17.14.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 14:16:09 -0700 (PDT) X-MC-Unique: mWz9RT_fPn6GtN-0mD3PhQ-1 X-MC-Unique: Fv1X8Ta-OiupxlGKsBuVAA-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=HxCOILoaySTp7nfWTlLVxn/PTvqCZPDEfwq3vzxRgZ0=; b=jY45FHia2bUdMmVbVIXJRYwKDwYJfxigbcG2NBo6MLmhiffjqAUPNBsan/QekKwYnQ /hBHsMQMtuCjpJOVQ/G+6lOw/VvlyZqOgY+DpdiHpPSab/CudSJjT1H9kHwJu3eSDXgq Vd3SOeQuB9tO+zU/DQGoRNgkPbQ0E/D9Z+R/Om4u7cnfLc992R8I7YUTPV5HZR/EhHQd 8kPAl6DG/saOOC8pVpH/8y6/iU9FqDj+4dPMBiy0WXDS6nFCZLhTEwFc4b/+QmX0QCXN ldIaxgxwpXzkne+UAyCyI9wYxZZwrefS0qwVcK+EmU4w+hOFOZcsT7dtha6dL1FCo5YW lF/A== X-Gm-Message-State: AOAM531Wf1ABQowbCm0GHyzLzPO8opx2KRrHlwn/nbHHNk/supKnxCjL znRwdIVQ0JF7BtZt+vy7FXmbwgJ9Rl4= X-Google-Smtp-Source: ABdhPJxSNoRlCnHw+MSRuAcGlzzb7ng6o7+IsP4ePPwn04wkzPAljpRMnriwm9tfFFZyJ845MCkwOw== X-Received: by 2002:ac8:134a:: with SMTP id f10mr12786968qtj.131.1595020569530; Fri, 17 Jul 2020 14:16:09 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/5] qemu_driver.c: modernize qemuConnectCPUModelBaseline() Date: Fri, 17 Jul 2020 18:15:54 -0300 Message-Id: <20200717211556.1024748-4-danielhb413@gmail.com> In-Reply-To: <20200717211556.1024748-1-danielhb413@gmail.com> References: <20200717211556.1024748-1-danielhb413@gmail.com> MIME-Version: 1.0 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.16 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() on pointers and remove the unneeded 'cleanup' label. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d185666ed8..d73d093465 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13342,50 +13342,44 @@ qemuConnectCPUModelBaseline(virQEMUCapsPtr qemuCa= ps, virCPUDefPtr *cpus, int ncpus) { - qemuProcessQMPPtr proc; - virCPUDefPtr ret =3D NULL; - virCPUDefPtr baseline =3D NULL; + g_autoptr(qemuProcessQMP) proc =3D NULL; + g_autoptr(virCPUDef) baseline =3D NULL; qemuMonitorCPUModelInfoPtr result =3D NULL; size_t i; =20 if (!(proc =3D qemuProcessQMPNew(virQEMUCapsGetBinary(qemuCaps), libDir, runUid, runGid, false))) - goto cleanup; + return NULL; =20 if (qemuProcessQMPStart(proc) < 0) - goto cleanup; + return NULL; =20 if (VIR_ALLOC(baseline) < 0) - goto cleanup; + return NULL; =20 if (virCPUDefCopyModel(baseline, cpus[0], false)) - goto cleanup; + return NULL; =20 for (i =3D 1; i < ncpus; i++) { if (qemuMonitorGetCPUModelBaseline(proc->mon, baseline, cpus[i], &result) < 0) - goto cleanup; + return NULL; =20 if (qemuConnectStealCPUModelFromInfo(baseline, &result) < 0) - goto cleanup; + return NULL; } =20 if (expand_features) { if (qemuMonitorGetCPUModelExpansion(proc->mon, QEMU_MONITOR_CPU_MODEL_EXPANSI= ON_FULL, baseline, true, false, &result= ) < 0) - goto cleanup; + return NULL; =20 if (qemuConnectStealCPUModelFromInfo(baseline, &result) < 0) - goto cleanup; + return NULL; } =20 - ret =3D g_steal_pointer(&baseline); - - cleanup: - qemuProcessQMPFree(proc); - virCPUDefFree(baseline); - return ret; + return g_steal_pointer(&baseline); } =20 =20 --=20 2.26.2