From nobody Sun Feb 8 05:40:54 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; dkim=pass; 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=1590177421; cv=none; d=zohomail.com; s=zohoarc; b=YtzzbW2x3SYJb0n/3/ydaP81yjY5FWxbZKl/SGCOoHc4vpsGtxgX7gIQ26nqoC5TOSlwa7oLA4cpYY9PzV7yQ01ucUy97rd3clh6RtxHoFeJ9T941n/f/kh6TTA0QkfAHnRxa3tlpKe4GEmrlBEJ2y0YQVYFAX1lR3BrklZRNBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590177421; 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=bnPAjZMZDZnkKAZP8u0brroRVD0yv5+KMYSN6cIT+1A=; b=QQNIThdxjCkn4y6cwmIct5VKR4ogQSfdd/RpQaRNXUjkrd9drBePbCltDZjLJL+sSwsg/JcvmkU03+9UCVGbUeq4MUJLI4N3cuoyGqoB8ediy4FV70Zec7y8PapqD2MYKSNm7Z7eqo94pDAwSul1+fyqGXrJu7mQqAZHa5f6yDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1590177421905686.3120118152639; Fri, 22 May 2020 12:57:01 -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-152-_Ldzs_CfN4WpymrRQVbhug-1; Fri, 22 May 2020 15:56:56 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B5DB835B40; Fri, 22 May 2020 19:56:51 +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 2A79B707BA; Fri, 22 May 2020 19:56:51 +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 F220454D0B; Fri, 22 May 2020 19:56:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04MJumUD030424 for ; Fri, 22 May 2020 15:56:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 63D79110F3AE; Fri, 22 May 2020 19:56:48 +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 53AB21043DDF for ; Fri, 22 May 2020 19:56:42 +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 8107D1859172 for ; Fri, 22 May 2020 19:56:42 +0000 (UTC) Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-390-clkalIqXMxabIjtVdnyJMg-1; Fri, 22 May 2020 15:56:40 -0400 Received: by mail-qv1-f53.google.com with SMTP id p4so5285623qvr.10 for ; Fri, 22 May 2020 12:56:39 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:e0b9:8f39:f7d8:19fe:be67]) by smtp.gmail.com with ESMTPSA id o23sm9247286qtf.53.2020.05.22.12.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 12:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590177420; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=bnPAjZMZDZnkKAZP8u0brroRVD0yv5+KMYSN6cIT+1A=; b=LJF7NK6nKMav7Zf4m0EbWxhX7sciWeAxudBPw9lEf5vcblf4lTCYrqecZdv2JobhaKrzpA KGaVNI2Ei10i1Piipy6yawIIcGtUEN3Hxs+COpC+EhOJeTTH1cK7YVfqidipILiF1/ig94 Ze311JyQopg1EsD9ucT8NSqy5RjwP5w= X-MC-Unique: _Ldzs_CfN4WpymrRQVbhug-1 X-MC-Unique: clkalIqXMxabIjtVdnyJMg-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=bnPAjZMZDZnkKAZP8u0brroRVD0yv5+KMYSN6cIT+1A=; b=f9nMWqWgizh7LFrIS1/QP6MZ3J9R2rf2nqeERVPufgrnuLbO3l4bThD1hIisPXxnAA M9hxUObUAn0nbtiqb3KESnspRNlS+nwvX33PJNjcr4R6gBP7RUV6ZkDn+stm4oqRyx8J 5jQ3eK+3KlwAuirzjrqRDhuuJq/ZSBsNboAZClAC+/tlzdxGM9wbWKPJ4KlZ0XW3qmPC W5v9CeyrXkputiEPMCzoPJuaSQ2+9PQe6Mw9xi+fXVEOOgX6rh4JEYvKaHGDeYNZ9EHW O1GMebwCWaIwDPYU3sfnIQWbIM8eO6FXgvKNi0uJH/af2LB2H0BtS0gcuN/jY1ikxqrR t10A== X-Gm-Message-State: AOAM531MZE7/OOjp+rPcbJYBLXNhD0r6tkebmnJmaw6Or9BguBHY379F zPPg8VTrDzsSG59LI7sV1c/9d3wM X-Google-Smtp-Source: ABdhPJy1xblBx5hBdWPYsaa4+KerK6LrTEAvDj9Y0JLZDvgRWRyMZEMtJHo4ZUfT0iMV5JqKtpYkbw== X-Received: by 2002:ad4:5a53:: with SMTP id ej19mr5180417qvb.79.1590177399210; Fri, 22 May 2020 12:56:39 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 2/5] cpu_arm.c: modernize virCPUarmUpdate Date: Fri, 22 May 2020 16:56:17 -0300 Message-Id: <20200522195620.3843442-3-danielhb413@gmail.com> In-Reply-To: <20200522195620.3843442-1-danielhb413@gmail.com> References: <20200522195620.3843442-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.13 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" Use automatic cleanup of variables. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Jiri Denemark --- src/cpu/cpu_arm.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 6f6c6a1479..cd4f720c95 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -415,8 +415,7 @@ static int virCPUarmUpdate(virCPUDefPtr guest, const virCPUDef *host) { - int ret =3D -1; - virCPUDefPtr updated =3D NULL; + g_autoptr(virCPUDef) updated =3D NULL; =20 if (guest->mode !=3D VIR_CPU_MODE_HOST_MODEL) return 0; @@ -424,24 +423,21 @@ virCPUarmUpdate(virCPUDefPtr guest, if (!host) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("unknown host CPU model")); - goto cleanup; + return -1; } =20 if (!(updated =3D virCPUDefCopyWithoutModel(guest))) - goto cleanup; + return -1; =20 updated->mode =3D VIR_CPU_MODE_CUSTOM; if (virCPUDefCopyModel(updated, host, true) < 0) - goto cleanup; + return -1; =20 virCPUDefStealModel(guest, updated, false); guest->mode =3D VIR_CPU_MODE_CUSTOM; guest->match =3D VIR_CPU_MATCH_EXACT; - ret =3D 0; =20 - cleanup: - virCPUDefFree(updated); - return ret; + return 0; } =20 =20 --=20 2.26.2