From nobody Sun Feb 8 03:57:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.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 207.211.31.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=1590177434; cv=none; d=zohomail.com; s=zohoarc; b=YOMzGGAaUJs/03wfAIx7si54MWk3+rVrUr7KQ0jl35kRwdXkZXB1DfLL75PI83WcbJmaLLVnPWzAlTxB+P6M6uBwat6Lx82p+u5JlCgT/BAZ7pIh2gDUXVe7pSFrtasFSYR5fpi4pW+gm9h7ITdpAJR29cHC0ax8IWykDevctWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590177434; 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=u4F8gpnU4UVzQiQCSoFgrzkKV+G/7ATWzL2+69KBCkw=; b=kM41cs18smPHIalG/pWuDJAjMt5QCIphpd+CH73dT89Co5RXBM7+p+KZiqP0wl2qWD6t4ynDgvIgabVn9j8qmqEiAPSsszl1wsCc80w4OSrDsw7aXyymIO8Ds7roxuqIyk52nu5IFsbnUn6TSBs7kPojOlbPECaEyyuujbu/ZoM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.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 [207.211.31.120]) by mx.zohomail.com with SMTPS id 1590177434009130.4750321222259; Fri, 22 May 2020 12:57:14 -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-405-KKVp3J6HNF2Ht6cW4fAFYg-1; Fri, 22 May 2020 15:57:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA9BD107ACF3; Fri, 22 May 2020 19:57:05 +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 81A7F6EA50; Fri, 22 May 2020 19:57:04 +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 51BED1809557; Fri, 22 May 2020 19:57:04 +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 04MJui62030384 for ; Fri, 22 May 2020 15:56:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 45E6FF567E; Fri, 22 May 2020 19:56:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37AD2F1C6D for ; Fri, 22 May 2020 19:56:44 +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 127F88EC772 for ; Fri, 22 May 2020 19:56:44 +0000 (UTC) Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-ZU7cCkPGM1S3ELAqIWN6YA-1; Fri, 22 May 2020 15:56:41 -0400 Received: by mail-qv1-f66.google.com with SMTP id fb16so5308707qvb.5 for ; Fri, 22 May 2020 12:56:41 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 12:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590177432; 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=u4F8gpnU4UVzQiQCSoFgrzkKV+G/7ATWzL2+69KBCkw=; b=C8NbFfyqUW+/tC7T6yRHuKKRXdXMiobtBEnFXtQyc01Nm6NaikX5jXmMlBz6xr5/uAfN9S OouDOXBsyZQKYMZKpdDBD/Av3EqdPn32Kjv65XZ2BxmpoNwAAdHoPqej1TiMEBQkg9N0f0 F3C+DDh8G1g+ljc7V8fUiJh5A5pA8lU= X-MC-Unique: KKVp3J6HNF2Ht6cW4fAFYg-1 X-MC-Unique: ZU7cCkPGM1S3ELAqIWN6YA-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=u4F8gpnU4UVzQiQCSoFgrzkKV+G/7ATWzL2+69KBCkw=; b=fy7USi8hMcTSB5Bbfx+0QN1Os+svcRdV5MP7K488DZGH6TP+Asr8QMG50DeqCCuFH+ wVDYnCgi35iNAFrR7Dofce+LfNFIYSl/kxZ07V62xyoveAy+aJLZ8kDFNTBAUrWFZnvO t2DaXRQFbBPi0lY0mgwWPzzPsb5mxSEhuywIczM2tGz5jJxOWsVqPgEnmhHEXLQwD7J1 NFwPzuopIXE0+uYpav1Zn03GuG0FxcDlFf7wSLrJyxh26dKoJQtFEBVwp3669m9BSvCk 2DAPotIf08nLd1kIoEzqUqy1GSxwWsE4XZFrswMsIwKBO7yGpOPWe6tqDzR2w1svDjXL pMUQ== X-Gm-Message-State: AOAM531bDrFq87U64kKjF/6sMhTaDYJjIjSMgylio2+/iBivfLGzbRm4 Sjb5xcENsQ2NhXjel1YHXJQ1fQwR X-Google-Smtp-Source: ABdhPJwimblE7S4K1kz6EOnKB0vDWhrRZwQxhVR4XaevixPChJV+rCcjF7rTBvR2BRG15/1mEPcCkA== X-Received: by 2002:a05:6214:1265:: with SMTP id r5mr5245658qvv.171.1590177400589; Fri, 22 May 2020 12:56:40 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/5] cpu_s390.c: modernize virCPUs390Update Date: Fri, 22 May 2020 16:56:18 -0300 Message-Id: <20200522195620.3843442-4-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.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.15 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_s390.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c index dd030c5a11..c1c5686244 100644 --- a/src/cpu/cpu_s390.c +++ b/src/cpu/cpu_s390.c @@ -45,8 +45,7 @@ static int virCPUs390Update(virCPUDefPtr guest, const virCPUDef *host) { - virCPUDefPtr updated =3D NULL; - int ret =3D -1; + g_autoptr(virCPUDef) updated =3D NULL; size_t i; =20 if (guest->mode =3D=3D VIR_CPU_MODE_CUSTOM) { @@ -58,37 +57,34 @@ virCPUs390Update(virCPUDefPtr guest, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("optional CPU features are not supported")); } - goto cleanup; + return -1; } =20 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 for (i =3D 0; i < guest->nfeatures; i++) { if (virCPUDefUpdateFeature(updated, guest->features[i].name, guest->features[i].policy) < 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