From nobody Fri May 3 14:46:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1629729459; cv=none; d=zohomail.com; s=zohoarc; b=Ns8jwI8oy6BVE8gWn4PO9hL6tXXeQfy9aGjnr6BYrqJuwIHWnP6HQEJ8tyHTDAFsAw0SGNDJqLZ1pG/9x4W7Y0N3bmICKS9s0JR2y+PhPmoadsViaiR3GCLSjX5AnBNEllbLrCA+oCriqtMPy9pnU5F3Pa3sXB0li8uvcUKlzOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629729459; 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=JSXeAwI7EjM4pjZ24bfI/6PIj1IbBPlpPZdFACkScqI=; b=HCZJqeWsYk87wn1YiSvrEZteFE56ZBfzE8DIwItQGCeorZZu6wAQ4Uk+mN6Ecf7Lfby5W9PbiUiGmOz1m3jxtMZenWwg+FvH0MyO+Ph+NwC+q3NOOXnnOJf0CNKuA9JdoIB1QmTTEpGGonK0dV4ZgnG7AAwoWofDlb35ZqVR+Rw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 16297294592345.034251418759254; Mon, 23 Aug 2021 07:37:39 -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-567-zhG8uyBgMZOyAA8S8Ay_cQ-1; Mon, 23 Aug 2021 10:37:35 -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 DDDB81009606; Mon, 23 Aug 2021 14:37:29 +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 BB62D68D95; Mon, 23 Aug 2021 14:37:29 +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 88AC34A7CB; Mon, 23 Aug 2021 14:37:29 +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 17NEbJpX019215 for ; Mon, 23 Aug 2021 10:37:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 82E455278E; Mon, 23 Aug 2021 14:37:19 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D30360861 for ; Mon, 23 Aug 2021 14:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629729458; 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=JSXeAwI7EjM4pjZ24bfI/6PIj1IbBPlpPZdFACkScqI=; b=NxUNrLt/Kr7pc7qyQP82rxW2HdPxiSFO+NqJbYROC83FaJB65UXg1WEKZR37Wls9ua6+9O KgRtKndRzS64uAte5ghZXYSjuoY5++Q9xrlcgMJF0Vk9Hlkv58uY/cV7xcFtN1+ZOURZW1 r+JZ6opwfuLpLMJqwO4rKQAhYnyID54= X-MC-Unique: zhG8uyBgMZOyAA8S8Ay_cQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/6] qemu: refactor virQEMUCapsNewForBinaryInternal Date: Mon, 23 Aug 2021 16:37:08 +0200 Message-Id: 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.16 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: 1629729459776100001 Use g_auto and remove pointless labels. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Kristina Hanicova Reviewed-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f6f4ee28fb..174352a5a2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5430,18 +5430,18 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, unsigned int microcodeVersion, const char *kernelVersion) { - virQEMUCaps *qemuCaps; + g_autoptr(virQEMUCaps) qemuCaps =3D NULL; struct stat sb; =20 if (!(qemuCaps =3D virQEMUCapsNewBinary(binary))) - goto error; + return NULL; =20 /* We would also want to check faccessat if we cared about ACLs, * but we don't. */ if (stat(binary, &sb) < 0) { virReportSystemError(errno, _("Cannot check QEMU binary %s"), binary); - goto error; + return NULL; } qemuCaps->ctime =3D sb.st_ctime; =20 @@ -5452,20 +5452,20 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, if (!virFileIsExecutable(binary)) { virReportSystemError(errno, _("QEMU binary %s is not executable"), binary); - goto error; + return NULL; } =20 if (virFileExists(QEMU_MODDIR)) { if (stat(QEMU_MODDIR, &sb) < 0) { virReportSystemError(errno, _("Cannot check QEMU module direct= ory %s"), QEMU_MODDIR); - goto error; + return NULL; } qemuCaps->modDirMtime =3D sb.st_mtime; } =20 if (virQEMUCapsInitQMP(qemuCaps, libDir, runUid, runGid) < 0) - goto error; + return NULL; =20 qemuCaps->libvirtCtime =3D virGetSelfLastChanged(); qemuCaps->libvirtVersion =3D LIBVIR_VERSION_NUMBER; @@ -5484,11 +5484,7 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, qemuCaps->kvmSupportsSecureGuest =3D virQEMUCapsKVMSupportsSecureG= uest(); } =20 - return qemuCaps; - - error: - virObjectUnref(qemuCaps); - return NULL; + return g_steal_pointer(&qemuCaps); } =20 static void * --=20 2.31.1 From nobody Fri May 3 14:46:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1629729467; cv=none; d=zohomail.com; s=zohoarc; b=OYqVtzRmEl4ex/fyGxYu1umpcwEjHMxh3rMax7gq6YxjhgABkKRJM13s/7maN+p3BTv7dxIplXYDderG/d9pOh4VJtWH6AvbMBV8zMzXgZziAt7WGFOk8hLzVZNig3kfvzTeFOt/I9ugPVM/3iuUCgnTseQzivwUOFCrPHkAOm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629729467; 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=PuQ1Svc4qkQ58JXFgAbmq7VW0v65Me3HPPEMP06UdCM=; b=NS4dcrmBYY11WC6LhLdJxVsEncwx0W/yoaZGmqiljQHSc9fuUzSIjYfx0ozLmEVTLv/QqKNhxqOvcIx7+BAnVWgBD36jVrCmWVBF3SmjQnFikWYd7noh0+8QQLtve4nA5dnWBvqdNtrAw7ZwmWEBM9eJVQR9fQmoCOVBk7x9DMg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1629729467904942.2200717419972; Mon, 23 Aug 2021 07:37:47 -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-1-3nIhx9NxPbW66crYsa_vYw-1; Mon, 23 Aug 2021 10:37:44 -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 3212E94DDB; Mon, 23 Aug 2021 14:37:39 +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 10D2D5D9D3; Mon, 23 Aug 2021 14:37:39 +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 D1D9D4A70F; Mon, 23 Aug 2021 14:37:38 +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 17NEbKgN019222 for ; Mon, 23 Aug 2021 10:37:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50D5B5278E; Mon, 23 Aug 2021 14:37:20 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE9CB60861 for ; Mon, 23 Aug 2021 14:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629729466; 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=PuQ1Svc4qkQ58JXFgAbmq7VW0v65Me3HPPEMP06UdCM=; b=ZxyFZTvfdE6pZ8pK7h6wAAzr5M3PQ+c/+i9C3SwAfHNHtOPrlgEmtxo4CVJf8A+p8S9cJm oZtmyPnWYqO5jlaXKswb1XgZD7MC4kXSN9IuSF7C7iW1cqc9RhHAnBn3TiGJEmN5U8HWWx We8CFiFf/TB13kpyXm1pEEU8UriXfNc= X-MC-Unique: 3nIhx9NxPbW66crYsa_vYw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/6] qemu: refactor virQEMUCapsLoadFile Date: Mon, 23 Aug 2021 16:37:09 +0200 Message-Id: <7b9b40879f29efe8ca0c49b0addb233b6e1788e8.1629729387.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.14 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: 1629729469291100001 Use g_auto and remove pointless labels. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Kristina Hanicova Reviewed-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 174352a5a2..a80c172d71 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5510,7 +5510,7 @@ virQEMUCapsLoadFile(const char *filename, void *privData, bool *outdated) { - virQEMUCaps *qemuCaps =3D virQEMUCapsNewBinary(binary); + g_autoptr(virQEMUCaps) qemuCaps =3D virQEMUCapsNewBinary(binary); virQEMUCapsCachePriv *priv =3D privData; int ret; =20 @@ -5519,17 +5519,13 @@ virQEMUCapsLoadFile(const char *filename, =20 ret =3D virQEMUCapsLoadCache(priv->hostArch, qemuCaps, filename, false= ); if (ret < 0) - goto error; + return NULL; if (ret =3D=3D 1) { *outdated =3D true; - goto error; + return NULL; } =20 - return qemuCaps; - - error: - virObjectUnref(qemuCaps); - return NULL; + return g_steal_pointer(&qemuCaps); } =20 =20 --=20 2.31.1 From nobody Fri May 3 14:46:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1629729461; cv=none; d=zohomail.com; s=zohoarc; b=dDjaneh2AoyE6ydEhEIHE3hdnPYMh5ckpLmqO8KhKPGQ070apCSvOd4n32ym4E5IHJc6GC5eF8ey7H2scj+feoT6vxFJFleRx75SIrqbUb9Q6+AV8ZDOzkh4PGu/PbqOiJEv1LY6QJ4COIoT374FweG+8msbeLv/7jGfjsrD4Y4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629729461; 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=un+ECo8ej6sC4Fj99kKQCnpl+MeIqFk8MXqO+UVfG6E=; b=Mqh8r6ioRybChha2plN/r9m/0G3TKc1nx0X4bd/eI8rMi7bYmqoLAwDpHlr2mgqWRts8rRC0Bo/BSR3M6heyIaRxTLHRGs3JFnZTUCAjUspm+w0maIaLmYZ7AUzo7SSSIOMBWKKfCXya70n35WHQ1QLrBit9Cr19EF6nY62HsMw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1629729461522536.4083480858235; Mon, 23 Aug 2021 07:37:41 -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-151-sIe8pHFDNsmoUPSyxn_yJw-1; Mon, 23 Aug 2021 10:37:38 -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 A8E65190D345; Mon, 23 Aug 2021 14:37:32 +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 7F7DC66FFF; Mon, 23 Aug 2021 14:37:32 +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 4A8644A707; Mon, 23 Aug 2021 14:37:32 +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 17NEbLda019234 for ; Mon, 23 Aug 2021 10:37:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2045360854; Mon, 23 Aug 2021 14:37:21 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DF7D7BE5B for ; Mon, 23 Aug 2021 14:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629729460; 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=un+ECo8ej6sC4Fj99kKQCnpl+MeIqFk8MXqO+UVfG6E=; b=IX73SuDifgQGf9zv1jmoBJdhs77jGB6tsywbb9IcVMVQt0uoxXQ+zKQ9TWlEtjv/TsjtZN jDbcOnD4xRsFglBcf4zFTARkHkRsxOZaNwx7DPt2BRWv5GNhASs+AMU+jcve/ji1Wac2Xt JTmxKLn6mYjja/vssYKxi/4jVqS6408= X-MC-Unique: sIe8pHFDNsmoUPSyxn_yJw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/6] qemu: refactor virQEMUCapsInit Date: Mon, 23 Aug 2021 16:37:10 +0200 Message-Id: <4bcce17ea7accc512ed596da3704a552911cd843.1629729387.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: 1629729462118100004 Use g_auto and remove pointless labels. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Kristina Hanicova Reviewed-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a80c172d71..380d0a5694 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1111,13 +1111,13 @@ virQEMUCapsProbeHostCPU(virArch hostArch, virCaps * virQEMUCapsInit(virFileCache *cache) { - virCaps *caps; + g_autoptr(virCaps) caps =3D NULL; size_t i; virArch hostarch =3D virArchFromHost(); =20 if ((caps =3D virCapabilitiesNew(hostarch, true, true)) =3D=3D NULL) - goto error; + return NULL; =20 if (virCapabilitiesInitCaches(caps) < 0) VIR_WARN("Failed to get host CPU cache info"); @@ -1145,13 +1145,9 @@ virQEMUCapsInit(virFileCache *cache) if (virQEMUCapsInitGuest(caps, cache, hostarch, i) < 0) - goto error; + return NULL; =20 - return caps; - - error: - virObjectUnref(caps); - return NULL; + return g_steal_pointer(&caps); } =20 =20 --=20 2.31.1 From nobody Fri May 3 14:46:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1629729464; cv=none; d=zohomail.com; s=zohoarc; b=EUoZGTjX7JWmbhIY8vjPiWVJIvPxy1VpVFBs/imGvC79DoGH7QamdEWKdSUDHQfdBuDRRgwqcJ0fcXXel6VD61NRh5DYvKvHEBeBUWfZOru9ZVjqyUuzOzzH8P1cikmrmD8gak+vGYZzQ/8GXtaZCFTrVJX5viENXr1QluApHmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629729464; 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=4vk21T6Ivh1bQ1RUHeV9ooNt7TS0pkV1JSNHFXEKHT8=; b=cKE6WrvkTLnhCRZMqbkABJcsrfwGlP1A271JmJtdoWsJ50efm74Pk4FtQWLWhvO/lQJZBmzeob5hm9cLkWIk1HXmKQqQrDlzJNPWwPwwkVumsVqpk+Jw0JQXxob0h3y4WcAL9dJ6O73fspNlwi5jZt05OmVLvYFWv5ARbf/51rA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 16297294641151004.8228987913061; Mon, 23 Aug 2021 07:37:44 -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-439-YPcN151OMpOXjkgmv2dvHQ-1; Mon, 23 Aug 2021 10:37:41 -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 C53151009600; Mon, 23 Aug 2021 14:37:35 +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 A7DC71B400; Mon, 23 Aug 2021 14:37:35 +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 6B880181A2A9; Mon, 23 Aug 2021 14:37:35 +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 17NEbL1e019247 for ; Mon, 23 Aug 2021 10:37:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id E210E1B400; Mon, 23 Aug 2021 14:37:21 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C0AA60854 for ; Mon, 23 Aug 2021 14:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629729463; 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=4vk21T6Ivh1bQ1RUHeV9ooNt7TS0pkV1JSNHFXEKHT8=; b=ZanCstYrcOIIHq04bkI6ku4eN4ljS8DIusP30B6otkzpxY3Sacy6NkmsZGev6oApWevroV uQbNumdEskoCKJKvsNjSU2/eWsp+vzMRDU7I2SdJYlZGNyc0vVhAtdXwXH8jMkLxVMay9N v0mpP8qQ0hv7H5ZVca4GLS/MtaN6Djs= X-MC-Unique: YPcN151OMpOXjkgmv2dvHQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] qemu: refactor virQEMUCapsNewCopy Date: Mon, 23 Aug 2021 16:37:11 +0200 Message-Id: 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.13 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: 1629729464815100001 Use g_auto and remove pointless labels. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Kristina Hanicova Reviewed-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 380d0a5694..fecd332604 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1953,7 +1953,7 @@ virQEMUCapsAccelCopy(virQEMUCapsAccel *dst, =20 virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) { - virQEMUCaps *ret =3D virQEMUCapsNewBinary(qemuCaps->binary); + g_autoptr(virQEMUCaps) ret =3D virQEMUCapsNewBinary(qemuCaps->binary); size_t i; =20 if (!ret) @@ -1980,7 +1980,7 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) =20 if (virQEMUCapsAccelCopy(&ret->kvm, &qemuCaps->kvm) < 0 || virQEMUCapsAccelCopy(&ret->tcg, &qemuCaps->tcg) < 0) - goto error; + return NULL; =20 ret->gicCapabilities =3D g_new0(virGICCapability, qemuCaps->ngicCapabi= lities); ret->ngicCapabilities =3D qemuCaps->ngicCapabilities; @@ -1990,13 +1990,9 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCap= s) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST) && virQEMUCapsSEVInfoCopy(&ret->sevCapabilities, qemuCaps->sevCapabilities) < 0) - goto error; + return NULL; =20 - return ret; - - error: - virObjectUnref(ret); - return NULL; + return g_steal_pointer(&ret); } =20 =20 --=20 2.31.1 From nobody Fri May 3 14:46:52 2024 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=1629729452; cv=none; d=zohomail.com; s=zohoarc; b=fptd3125DPxeykNbL5VjpNMjOPO6Dp1zLXZGSl0idIyS/FwkeGL+iSL47cgtoXBDHy60eSqwnGairmpIjwrKngMbOP8fu6eMLaeZ/OkJS0jgG7RfETS/PN+cpLHTPUez+vCUmp5hB/w5/7A9b6xVwhnfxcBhuf4Rc7Ql7EZSokA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629729452; 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=TpbW7+9rQg8dKQf3a+vIPQKIYgjTDguxYLJCqAPXqnw=; b=G1upwr+6b0bHkwzDZ7d9wcL+Tqw0ruttRerJPJv29EJ/rpCHQ7wFIOYnVMXimrpuoyFL6ufXWANBphC8tZoWHPrB85kiPAH72ROIw2KYeAJjQZLq9ha0Qj6BaoYjVb2u9f8CzGds0ecIqB8bHKlNd7IakMaJBRauiobDC/zCtJ8= 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 1629729452497486.0396602894415; Mon, 23 Aug 2021 07:37:32 -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-294-oaPdk2suMPyi6bJ_akdXxw-1; Mon, 23 Aug 2021 10:37:29 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 359CA801AC0; Mon, 23 Aug 2021 14:37:24 +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 10CDB105C86C; Mon, 23 Aug 2021 14:37:24 +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 CC8094A7C8; Mon, 23 Aug 2021 14:37:23 +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 17NEbMOF019258 for ; Mon, 23 Aug 2021 10:37:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF6A460861; Mon, 23 Aug 2021 14:37:22 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39D4160854 for ; Mon, 23 Aug 2021 14:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629729451; 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=TpbW7+9rQg8dKQf3a+vIPQKIYgjTDguxYLJCqAPXqnw=; b=dQEkzTjaxTrqPFXC8imNHF52OAfTsjQTtN0ct6WdkbJWRRSv9ok8U+SBFXDjLhahc1KAmk YYD1G4pJnRhgQGzgbFnKKVHHkUjKW698QfIZZcVdtTQLJGw0r8ed2vcSrfLkTUzKmkNy/o TNU4mdPXhtBgzD5fpnYYbc5QnBej9r8= X-MC-Unique: oaPdk2suMPyi6bJ_akdXxw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 5/6] qemu: capabilities: use g_auto Date: Mon, 23 Aug 2021 16:37:12 +0200 Message-Id: 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.84 on 10.5.11.22 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: 1629729452929100001 Where easily possible, declare variables with g_auto to reduce the amount of calls in cleanup sections. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Kristina Hanicova Reviewed-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index fecd332604..4dc2a9805d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2980,10 +2980,10 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, virDomainVirtType virtType) { const char *model =3D virtType =3D=3D VIR_DOMAIN_VIRT_KVM ? "host" : "= max"; - qemuMonitorCPUModelInfo *modelInfo =3D NULL; - qemuMonitorCPUModelInfo *nonMigratable =3D NULL; - GHashTable *hash =3D NULL; - virCPUDef *cpu; + g_autoptr(qemuMonitorCPUModelInfo) modelInfo =3D NULL; + g_autoptr(qemuMonitorCPUModelInfo) nonMigratable =3D NULL; + g_autoptr(GHashTable) hash =3D NULL; + g_autoptr(virCPUDef) cpu =3D NULL; qemuMonitorCPUModelExpansionType type; bool fail_no_props =3D true; int ret =3D -1; @@ -3061,10 +3061,6 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, ret =3D 0; =20 cleanup: - virHashFree(hash); - qemuMonitorCPUModelInfoFree(nonMigratable); - qemuMonitorCPUModelInfoFree(modelInfo); - virCPUDefFree(cpu); =20 return ret; } @@ -3084,7 +3080,7 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps, char ***features) { qemuMonitorCPUModelInfo *modelInfo; - char **list; + g_auto(GStrv) list =3D NULL; size_t i; size_t n; int ret =3D -1; @@ -3113,7 +3109,6 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps, else ret =3D 0; =20 - g_strfreev(list); return ret; } =20 @@ -3499,7 +3494,7 @@ virQEMUCapsGetCPUModelX86Data(virQEMUCaps *qemuCaps, unsigned long long sigFamily =3D 0; unsigned long long sigModel =3D 0; unsigned long long sigStepping =3D 0; - virCPUData *data =3D NULL; + g_autoptr(virCPUData) data =3D NULL; virCPUData *ret =3D NULL; size_t i; =20 @@ -3547,7 +3542,6 @@ virQEMUCapsGetCPUModelX86Data(virQEMUCaps *qemuCaps, ret =3D g_steal_pointer(&data); =20 cleanup: - virCPUDataFree(data); return ret; } =20 @@ -3565,7 +3559,7 @@ virQEMUCapsInitCPUModelX86(virQEMUCaps *qemuCaps, bool migratable) { g_autoptr(virDomainCapsCPUModels) cpuModels =3D NULL; - virCPUData *data =3D NULL; + g_autoptr(virCPUData) data =3D NULL; int ret =3D -1; =20 if (!model) @@ -3582,7 +3576,6 @@ virQEMUCapsInitCPUModelX86(virQEMUCaps *qemuCaps, ret =3D 0; =20 cleanup: - virCPUDataFree(data); return ret; } =20 @@ -3769,9 +3762,9 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, { char *str =3D NULL; xmlNodePtr hostCPUNode; - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) - qemuMonitorCPUModelInfo *hostCPU =3D NULL; + g_autoptr(qemuMonitorCPUModelInfo) hostCPU =3D NULL; g_autofree char *xpath =3D g_strdup_printf("./hostCPU[@type=3D'%s']", = typeStr); int ret =3D -1; size_t i; @@ -3881,8 +3874,6 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, =20 cleanup: VIR_FREE(str); - VIR_FREE(nodes); - qemuMonitorCPUModelInfoFree(hostCPU); return ret; } =20 @@ -4655,7 +4646,7 @@ virQEMUCapsSaveFile(void *data, void *privData G_GNUC_UNUSED) { virQEMUCaps *qemuCaps =3D data; - char *xml =3D NULL; + g_autofree char *xml =3D NULL; int ret =3D -1; =20 xml =3D virQEMUCapsFormatCache(qemuCaps); @@ -4674,7 +4665,6 @@ virQEMUCapsSaveFile(void *data, =20 ret =3D 0; cleanup: - VIR_FREE(xml); return ret; } =20 @@ -5189,7 +5179,7 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qe= muCaps, { struct virQEMUCapsStringFlags *entry; virJSONValue *schemareply; - GHashTable *schema =3D NULL; + g_autoptr(GHashTable) schema =3D NULL; size_t i; =20 if (!(schemareply =3D qemuMonitorQueryQMPSchema(mon))) @@ -5214,7 +5204,6 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qe= muCaps, virQEMUCapsSet(qemuCaps, entry->flag); } =20 - virHashFree(schema); return 0; } =20 @@ -5575,7 +5564,7 @@ virQEMUCapsCacheNew(const char *libDir, uid_t runUid, gid_t runGid) { - char *capsCacheDir =3D NULL; + g_autofree char *capsCacheDir =3D NULL; virFileCache *cache =3D NULL; virQEMUCapsCachePriv *priv =3D NULL; struct utsname uts; @@ -5603,7 +5592,6 @@ virQEMUCapsCacheNew(const char *libDir, priv->kernelVersion =3D g_strdup_printf("%s %s", uts.release, uts.= version); =20 cleanup: - VIR_FREE(capsCacheDir); return cache; =20 error: --=20 2.31.1 From nobody Fri May 3 14:46:52 2024 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=1629729460; cv=none; d=zohomail.com; s=zohoarc; b=gHOAt+94QaWq04h08Tm85SJ3hB90pRrpw8krJ6KAM8dV/o/XibVnJYAXk0aK/T15u5DujsWcejRK2o072JIc0sJ15YvECjZC/N5+S01TdMQP+jphSgXXMJWI9E0JNs+u4JVPLUCtW99a237sh/vgNnBGErUSLnhIuivR06DPnDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629729460; 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=djxVpl0vYnGwATPTwQR4Ddmr+MPdGJwQNVeJm2p8xMo=; b=WVEJdxiQ51MS1e3zNMaFme9Ywk4opfPD80Um35IOBO+6GOBCXWYFc0blJVH1i1Z1OvtIIJhj48NtwZ1WuRXw5u8RgMnPEX7Iespsq6dHBWUCq0GlrD8majjlO5UFXcnpAYeUX60+/0qsZh1bLTD8Kb7VPTk7bidPxQiF+L/Pk0Y= 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 1629729460860410.31475733175216; Mon, 23 Aug 2021 07:37:40 -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-568-16-E0sYPPq-iMcbrfF4X5w-1; Mon, 23 Aug 2021 10:37:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3032E8799ED; Mon, 23 Aug 2021 14:37:32 +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 0EF3560E1C; Mon, 23 Aug 2021 14:37:32 +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 9B3A14A7CD; Mon, 23 Aug 2021 14:37:31 +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 17NEbNpN019263 for ; Mon, 23 Aug 2021 10:37:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D02C60861; Mon, 23 Aug 2021 14:37:23 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 077EF60854 for ; Mon, 23 Aug 2021 14:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629729459; 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=djxVpl0vYnGwATPTwQR4Ddmr+MPdGJwQNVeJm2p8xMo=; b=JIU6ltn8Y+6RobRjAC2FnalDj9g2arYGIeP52EyuXvBvdsrVuMPdxa1w098tJMP+SWWLhk rhkE2RXIm0vE43J0eabK01lkrekCq88C41/x4oNxGtYOwZ+6TBUCPIG5zEWWm+QIlMA+1D v+mYj8Nf5NoZcsQGP4ew2EiO6hi181o= X-MC-Unique: 16-E0sYPPq-iMcbrfF4X5w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 6/6] qemu: capabilities: remove pointless labels Date: Mon, 23 Aug 2021 16:37:13 +0200 Message-Id: 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.12 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: 1629729462044100003 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Kristina Hanicova Reviewed-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 44 ++++++++++++------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4dc2a9805d..286d34ae54 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2986,7 +2986,6 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, g_autoptr(virCPUDef) cpu =3D NULL; qemuMonitorCPUModelExpansionType type; bool fail_no_props =3D true; - int ret =3D -1; =20 if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) return 0; @@ -3017,14 +3016,14 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, =20 if (qemuMonitorGetCPUModelExpansion(mon, type, cpu, true, fail_no_prop= s, &modelInfo) < 0) - goto cleanup; + return -1; =20 /* Try to check migratability of each feature. */ if (modelInfo && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_MIGRA= TABLE) && qemuMonitorGetCPUModelExpansion(mon, type, cpu, false, fail_no_pro= ps, &nonMigratable) < 0) - goto cleanup; + return -1; =20 if (nonMigratable) { qemuMonitorCPUProperty *prop; @@ -3036,7 +3035,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, for (i =3D 0; i < modelInfo->nprops; i++) { prop =3D modelInfo->props + i; if (virHashAddEntry(hash, prop->name, prop) < 0) - goto cleanup; + return -1; } =20 for (i =3D 0; i < nonMigratable->nprops; i++) { @@ -3058,11 +3057,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, } =20 accel->hostCPU.info =3D g_steal_pointer(&modelInfo); - ret =3D 0; - - cleanup: - - return ret; + return 0; } =20 =20 @@ -3495,11 +3490,10 @@ virQEMUCapsGetCPUModelX86Data(virQEMUCaps *qemuCaps, unsigned long long sigModel =3D 0; unsigned long long sigStepping =3D 0; g_autoptr(virCPUData) data =3D NULL; - virCPUData *ret =3D NULL; size_t i; =20 if (!(data =3D virCPUDataNew(VIR_ARCH_X86_64))) - goto cleanup; + return NULL; =20 for (i =3D 0; i < model->nprops; i++) { qemuMonitorCPUProperty *prop =3D model->props + i; @@ -3512,14 +3506,14 @@ virQEMUCapsGetCPUModelX86Data(virQEMUCaps *qemuCaps, continue; =20 if (virCPUDataAddFeature(data, name) < 0) - goto cleanup; + return NULL; =20 break; =20 case QEMU_MONITOR_CPU_PROPERTY_STRING: if (STREQ(name, "vendor") && virCPUx86DataSetVendor(data, prop->value.string) < 0) - goto cleanup; + return NULL; break; =20 case QEMU_MONITOR_CPU_PROPERTY_NUMBER: @@ -3537,12 +3531,9 @@ virQEMUCapsGetCPUModelX86Data(virQEMUCaps *qemuCaps, } =20 if (virCPUx86DataSetSignature(data, sigFamily, sigModel, sigStepping) = < 0) - goto cleanup; + return NULL; =20 - ret =3D g_steal_pointer(&data); - - cleanup: - return ret; + return g_steal_pointer(&data); } =20 =20 @@ -3560,23 +3551,19 @@ virQEMUCapsInitCPUModelX86(virQEMUCaps *qemuCaps, { g_autoptr(virDomainCapsCPUModels) cpuModels =3D NULL; g_autoptr(virCPUData) data =3D NULL; - int ret =3D -1; =20 if (!model) return 1; =20 if (!(data =3D virQEMUCapsGetCPUModelX86Data(qemuCaps, model, migratab= le))) - goto cleanup; + return -1; =20 cpuModels =3D virQEMUCapsGetCPUModels(qemuCaps, type, NULL, NULL); =20 if (cpuDecode(cpu, data, cpuModels) < 0) - goto cleanup; + return -1; =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 =20 @@ -4647,7 +4634,6 @@ virQEMUCapsSaveFile(void *data, { virQEMUCaps *qemuCaps =3D data; g_autofree char *xml =3D NULL; - int ret =3D -1; =20 xml =3D virQEMUCapsFormatCache(qemuCaps); =20 @@ -4655,7 +4641,7 @@ virQEMUCapsSaveFile(void *data, virReportSystemError(errno, _("Failed to save '%s' for '%s'"), filename, qemuCaps->binary); - goto cleanup; + return -1; } =20 VIR_DEBUG("Saved caps '%s' for '%s' with (%lld, %lld)", @@ -4663,9 +4649,7 @@ virQEMUCapsSaveFile(void *data, (long long)qemuCaps->ctime, (long long)qemuCaps->libvirtCtime); =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 --=20 2.31.1