From nobody Sun Feb 8 21:48:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1630940345; cv=none; d=zohomail.com; s=zohoarc; b=QdIZ+XthJvMatX02JWDTjRB+6LZ/uCCzopf0dKoEZ1tgr3xhVvHBtuxcq061DMKjktSXxGfcDeQZnkMFG3k5R407gZMD02RZhX6kmMrUqdK3XsVwy+E35uLLGxCy62eYWao+MrLkK56LDAlW83imiYm4vm/rCJgrt2Nwu4PH9QI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630940345; 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=AnZii8O2mdVTo47JXblbfnXCja/BquWaFxCe11X6BFU=; b=ZvolrH8VeNsQhaNbT+uDIvOqoPFcdzWKZi7oDyIw/PiDoGRasmSpL5q3ErWdu5Zhpzqin2dekIhHkY/d7FUiStGy31mF6tevypMZnyh+tMxmv/NbvCdEdBPOCq22ET0TYZ8mdE0sxpi1lmOZzVMFfbg9TrHxm/fTlrkHbZlY4mc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1630940345742166.8699326916519; Mon, 6 Sep 2021 07:59:05 -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-170-kKeUSPYaPjil5U3RK781Hg-1; Mon, 06 Sep 2021 10:59:02 -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 15E12824FA8; Mon, 6 Sep 2021 14:58:58 +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 C68931ABD8; Mon, 6 Sep 2021 14:58:57 +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 8F83744A5C; Mon, 6 Sep 2021 14:58:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 186EwuRI004476 for ; Mon, 6 Sep 2021 10:58:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A48E6608B; Mon, 6 Sep 2021 14:58:56 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15148779CE for ; Mon, 6 Sep 2021 14:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630940344; 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=AnZii8O2mdVTo47JXblbfnXCja/BquWaFxCe11X6BFU=; b=KlgWABNZ2T7K4/sS+Uop5V2b4dIMqbtTtx9Gi5J4SXfcjrrOBimeFpw5w1RZK4ZA03ScVk qKM5U89HhOyd1ibapr8l5iiE1/Et7ctDp9SGfZOJns/d6dzNNsELwcGijVH/2+EpM/KbY7 K8DrpmyztTZLMU25lW7TsXmQRbwM4YQ= X-MC-Unique: kKeUSPYaPjil5U3RK781Hg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] libxl: refactor libxlCapsInitCPU Date: Mon, 6 Sep 2021 16:58:47 +0200 Message-Id: <3056f3e6e37370984aad3e2dfccd4f3be57a6088.1630939770.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630940346245100005 Use g_auto, g_steal_pointer and remove unnecessary labels. Signed-off-by: J=C3=A1n Tomko --- src/libxl/libxl_capabilities.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 9d0ed921bd..38a9b36d8b 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -138,9 +138,8 @@ libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap) static int libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info) { - virCPUData *data =3D NULL; - virCPUDef *cpu =3D NULL; - int ret =3D -1; + g_autoptr(virCPUData) data =3D NULL; + g_autoptr(virCPUDef) cpu =3D NULL; int host_pae; int host_lm; =20 @@ -153,7 +152,7 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_inf= o) host_pae =3D phy_info->hw_cap[0] & LIBXL_X86_FEATURE_PAE_MASK; if (host_pae && virCapabilitiesAddHostFeature(caps, "pae") < 0) - goto error; + return -1; =20 host_lm =3D (phy_info->hw_cap[2] & LIBXL_X86_FEATURE_LM_MASK); if (host_lm) @@ -171,20 +170,11 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_i= nfo) cpuDecode(cpu, data, NULL) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to initialize host cpu features")); - goto error; + return -1; } =20 - caps->host.cpu =3D cpu; - ret =3D 0; - - cleanup: - virCPUDataFree(data); - - return ret; - - error: - virCPUDefFree(cpu); - goto cleanup; + caps->host.cpu =3D g_steal_pointer(&cpu); + return 0; } =20 static int --=20 2.31.1