From nobody Sun Feb 8 20:17:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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=1585316699; cv=none; d=zohomail.com; s=zohoarc; b=S8Fu+gW9C+gHx1Z4M8RJ4G4JHElp+Cq2aY7xWs2V5o9KsjgkASSXwsV88mHf0VXegteITTXdoaG5HFQPEQgs4rPuieQ9AbLpc6CI/OrQcWNxvNb/Nva/Gq77bgNUS9/lcEq+QvvLd2KH9HJnKrY5GsXGikOz1STq9svm1mK7pIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316699; 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=OvvmQrVjOqarS+fB+IEjdpbBsHD7Jq2bNHkSvTm9BBA=; b=AEMHXqGNLYlWXBsC5n/VMJ/qrKNAYLLXZDld7yv7VEmW9RmTTJ9ImehRyAMWgcHou09KDZeHxHcvoxzbrmtylT5DGLkZIRSecr1923G3mtBMFCev7TgNSYXdS+dRWcDOpDisTN8IrtdHVQjLid5AabytA6u63+iDkGRujrZtKcA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316699538829.1858009586311; Fri, 27 Mar 2020 06:44:59 -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-87-HBSKK65qOhaicbWJfyOGFA-1; Fri, 27 Mar 2020 09:44:56 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1BAB71088382; Fri, 27 Mar 2020 13:44:50 +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 E91C55DA89; Fri, 27 Mar 2020 13:44: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 792FB1803C43; Fri, 27 Mar 2020 13:44:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiNbZ006336 for ; Fri, 27 Mar 2020 09:44:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 47F58CDBE1; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 162D3A0A98 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id DE1C718D193; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316698; 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=OvvmQrVjOqarS+fB+IEjdpbBsHD7Jq2bNHkSvTm9BBA=; b=LsXJOk3UFf6aNBFrpaz+jhweK/3H/J/ZoZ8F/mvQApow5PFl8Zem/K8P61y8T7dU3FQi9a eypHLLHgu97JnCsCfSiKP1FHyP0MYpiiPQ7htZGMdsmcBdRt5t7v99Wgnlpq2RLxNSwI2N yNujZcKskIvi7iFlffTMIKktsSmtx3E= X-MC-Unique: HBSKK65qOhaicbWJfyOGFA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 11/39] cpu_x86: Use g_auto* in x86ModelFromCPU Date: Fri, 27 Mar 2020 14:43:40 +0100 Message-Id: <993736712c5124dd65e80e8ad36251b77f73b7aa.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.14 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" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index d2bbcbd891..9455fd1440 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1173,7 +1173,7 @@ x86ModelFromCPU(const virCPUDef *cpu, virCPUx86MapPtr map, int policy) { - virCPUx86ModelPtr model =3D NULL; + g_autoptr(virCPUx86Model) model =3D NULL; size_t i; =20 /* host CPU only contains required features; requesting other features @@ -1216,7 +1216,7 @@ x86ModelFromCPU(const virCPUDef *cpu, if (!(feature =3D x86FeatureFind(map, cpu->features[i].name))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown CPU feature %s"), cpu->features[i].n= ame); - goto error; + return NULL; } =20 if (policy =3D=3D -1) { @@ -1224,7 +1224,7 @@ x86ModelFromCPU(const virCPUDef *cpu, case VIR_CPU_FEATURE_FORCE: case VIR_CPU_FEATURE_REQUIRE: if (x86DataAdd(&model->data, &feature->data) < 0) - goto error; + return NULL; break; =20 case VIR_CPU_FEATURE_DISABLE: @@ -1238,15 +1238,11 @@ x86ModelFromCPU(const virCPUDef *cpu, break; } } else if (x86DataAdd(&model->data, &feature->data) < 0) { - goto error; + return NULL; } } =20 - return model; - - error: - x86ModelFree(model); - return NULL; + return g_steal_pointer(&model); } =20 =20 --=20 2.26.0