From nobody Sat Apr 20 04:03:17 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=1599633491; cv=none; d=zohomail.com; s=zohoarc; b=Y2kIRuTJETzaw8isjKGmNNurtSnaM8IyTxW851GalOKAt4wjUUrh4QRw+ZOcEQ+j5rUKZP6VD6ZDZDxnwQcZ0VNbL3TemFPnTQ/+pxe0e0C6mGGp1fK0n6OERGfv2HbG+dhxhZZNJgGDGAfp8tgNPLLfOpNKb8E8kR4IUE1lRVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599633491; 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=zJnUy+bdRy/JQvDDS5uVnre4pXnTDAbUrGcr/w0HnHs=; b=TIT9y6btsr+TT1kET+xg66KPFoo60K3m3f0PLcUyVPkYRQ12QP54S0pElwg8hAkV3BKkN2x5NYtQLRrQ0pKnfjJtHCz7qnFXyv2uIiqyo14ogREnd6drnD52vTdBTL077/dguGQ5v/A8HV7v3YV3g/Zm0JEdtr2PC3HgbbYEGCE= 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) header.from= 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 1599633491577452.9506453299633; Tue, 8 Sep 2020 23:38:11 -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-127-2WvjIR1MN5mpCq5C_NcErQ-1; Wed, 09 Sep 2020 02:38:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65C351091068; Wed, 9 Sep 2020 06:38:01 +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 3ACA327CC4; Wed, 9 Sep 2020 06:38:01 +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 CF9F07A018; Wed, 9 Sep 2020 06:38:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0896bvT0018286 for ; Wed, 9 Sep 2020 02:37:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDEAC83565; Wed, 9 Sep 2020 06:37:57 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-145.ams2.redhat.com [10.36.112.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3331883564; Wed, 9 Sep 2020 06:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599633490; 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=zJnUy+bdRy/JQvDDS5uVnre4pXnTDAbUrGcr/w0HnHs=; b=fK8oQ8QR+nLK3tgB9onkp4i9QB33TnfUWhQVMkg2vUBWZP6QnewKByIRoNC3I3azUodF9B Ki1KOKjmTWDozntxYERKUfZB4oazgB6V1QiOCpeabYePhWntNp8Kf+KqFAi5NItlio7DgL M6BpHz+JQ0ceFL1JUiFWliwLKfHR5W0= X-MC-Unique: 2WvjIR1MN5mpCq5C_NcErQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/2] cpu_map: Use g_auto* in loadData Date: Wed, 9 Sep 2020 08:37:50 +0200 Message-Id: <20200909063751.10103-2-twiederh@redhat.com> In-Reply-To: <20200909063751.10103-1-twiederh@redhat.com> References: <20200909063751.10103-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 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: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_map.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index 3abec68c60..65d244e011 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -39,20 +39,19 @@ loadData(const char *mapfile, cpuMapLoadCallback callback, void *data) { - int ret =3D -1; VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; int n; size_t i; int rv; =20 if ((n =3D virXPathNodeSet(element, ctxt, &nodes)) < 0) - goto cleanup; + return -1; =20 if (n > 0 && !callback) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected element '%s' in CPU map '%s'"), eleme= nt, mapfile); - goto cleanup; + return -1; } =20 for (i =3D 0; i < n; i++) { @@ -60,22 +59,17 @@ loadData(const char *mapfile, if (!name) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find %s name in CPU map '%s'"), eleme= nt, mapfile); - goto cleanup; + return -1; } VIR_DEBUG("Load %s name %s", element, name); ctxt->node =3D nodes[i]; rv =3D callback(ctxt, name, data); VIR_FREE(name); if (rv < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - - cleanup: - VIR_FREE(nodes); - - return ret; + return 0; } =20 static int --=20 2.26.2 From nobody Sat Apr 20 04:03:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1599633496; cv=none; d=zohomail.com; s=zohoarc; b=f5hlRr4yA0W2yoonKMHWmznwcEA8WaCG7tPiCPwXS9VusmpLHYiqEYmFQcTo6YRgVKTYKsj/XHy2zO5Lm45f49kM3iGkYhcEwE/XW+GoA1nYyamxp5SwfCK4KhQqQ1vMB2GD+BaevqZLSiwWspgV7Lqt2WGabgeRGGKUgP6Qch8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599633496; 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=enoLKqK77si6m8siy5zqUU6qeToL9msjoYhMe5HF9EA=; b=Am6u6DCp3ZMfKQ7Fx4RGGFuOCbF8dwOmduBG2GEdJIVFExxOEVXHM9Q5WCf44MoU/GBqVSedpo+zJnkK+DJcoudNu4cIwHiZXnJxfMbms70a3AmJeE4Bs/yO+GSKx8xbux8H0vGdHl94I7A2gNHHn8B2LOEvvFoWFXF5w80pZqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1599633496233742.7036579433928; Tue, 8 Sep 2020 23:38:16 -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-368-lh7LNmyTNzW3a5IQl0P7rw-1; Wed, 09 Sep 2020 02:38:12 -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 1719A1006711; Wed, 9 Sep 2020 06:38:07 +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 EA2EC82470; Wed, 9 Sep 2020 06:38:06 +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 B8D277A01C; Wed, 9 Sep 2020 06:38:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0896bwgB018297 for ; Wed, 9 Sep 2020 02:37:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id ECBCC811BE; Wed, 9 Sep 2020 06:37:58 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-145.ams2.redhat.com [10.36.112.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B92983564; Wed, 9 Sep 2020 06:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599633494; 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=enoLKqK77si6m8siy5zqUU6qeToL9msjoYhMe5HF9EA=; b=BC3qX9Hsxynf1eKfPmk/8nhRL5JJ6sXrVuSZkL71+42VjY32qqpI0lzitFL+IzvHXCtJMK ENjWf5UbqDQkxWJKr2NGgnFIPDpa5/+RJRSF+PNTHOiCJSCqIpBu9Dn4bxfbZ+YIX6uHP1 MJe4QyZKtT/mPnUR4XEHC55f+cWx8ms= X-MC-Unique: lh7LNmyTNzW3a5IQl0P7rw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/2] cpu_ppc64: Remove error path in virCPUppc64DriverGetModels Date: Wed, 9 Sep 2020 08:37:51 +0200 Message-Id: <20200909063751.10103-3-twiederh@redhat.com> In-Reply-To: <20200909063751.10103-1-twiederh@redhat.com> References: <20200909063751.10103-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The call to `g_strfreev` is not required, as in both cases no memory has be= en allocated. Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 9e6f1e856e..28fbfea9ae 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -738,24 +738,17 @@ virCPUppc64DriverGetModels(char ***models) size_t i; =20 if (!(map =3D ppc64LoadMap())) - goto error; + return -1; =20 if (models) { if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0) - goto error; + return -1; =20 for (i =3D 0; i < map->nmodels; i++) (*models)[i] =3D g_strdup(map->models[i]->name); } =20 return map->nmodels; - - error: - if (models) { - g_strfreev(*models); - *models =3D NULL; - } - return -1; } =20 struct cpuArchDriver cpuDriverPPC64 =3D { --=20 2.26.2