From nobody Sat Apr 27 00:03:48 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=1633700216; cv=none; d=zohomail.com; s=zohoarc; b=N/JCHFdpx88Gpu+Cf02TnniBpzSLJVCtYdy7R8oxGT4DxoNJYfsEHusom1mCd36lL8xXpVH2twmf2DH5xS5ZDlyNDNLX6hvjyoEMT8JFVRnx+w/xjwWe6F3bS8gQhbIc/6LlGwL/pTBDyACpHlbXHmKMYfmC6G18ox5uRBeADRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633700216; 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=w5sg7f6+OmuKDzIa9SxGs26gbCo2T8TfgXfAXwoG/7w=; b=goGXkpcmcQqugMsFlhFyDA3CG6dfz1sWe0Ojj+uzrz0W2gxgVWS7EDlIwWqP+TAtCROFE7g+92wOk7YkT2VqMgYnGQriFEMJ6s5n+A3h2AGds+0pCGCLCTw8Dni6RuW0dSYo7DCHNF7nbpUNinVPM+ULakOaEr/FVEEu+crP60I= 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 1633700216992812.9059341977229; Fri, 8 Oct 2021 06:36:56 -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-5-yWJENIJPPh21-cpbBpAywA-1; Fri, 08 Oct 2021 09:36:42 -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 08D3DAC092; Fri, 8 Oct 2021 13:35:17 +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 D3F125F4E7; Fri, 8 Oct 2021 13:35:16 +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 9DE5F1806D00; Fri, 8 Oct 2021 13:35:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 198DZFSL026076 for ; Fri, 8 Oct 2021 09:35:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 55D1E1973B; Fri, 8 Oct 2021 13:35:15 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.193.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DBC4196E2; Fri, 8 Oct 2021 13:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633700215; 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=w5sg7f6+OmuKDzIa9SxGs26gbCo2T8TfgXfAXwoG/7w=; b=VD5FkYSLZyhJQsZwc2BCiFSX1lJHzJ0y3MtgkmIdzguWxB2Id4XMY4z3JA/3+igh6YpmA0 bIZpn6DPmgbIzBwMRO/ORuSqmlFhe6vYsBJd1NtD9OEyZKAIYwAF46cIvrGia7VWamfgzt y2NU6V1jFSn/RiTEcVDoFoF469fBF8I= X-MC-Unique: yWJENIJPPh21-cpbBpAywA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 04/15] qom: Reduce use of error_propagate() Date: Fri, 8 Oct 2021 15:34:31 +0200 Message-Id: <20211008133442.141332-5-kwolf@redhat.com> In-Reply-To: <20211008133442.141332-1-kwolf@redhat.com> References: <20211008133442.141332-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, damien.hedde@greensocs.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, mst@redhat.com, libvir-list@redhat.com, jasowang@redhat.com, quintela@redhat.com, armbru@redhat.com, vsementsov@virtuozzo.com, lvivier@redhat.com, its@irrelevant.dk, pbonzini@redhat.com, eblake@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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633700217313100001 Content-Type: text/plain; charset="utf-8" ERRP_GUARD() makes debugging easier by making sure that &error_abort still fails at the real origin of the error instead of error_propagate(). Signed-off-by: Kevin Wolf Reviewed-by: Markus Armbruster --- qom/object.c | 7 +++---- qom/object_interfaces.c | 19 ++++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/qom/object.c b/qom/object.c index e86cb05b84..6be710bc40 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1389,7 +1389,7 @@ bool object_property_get(Object *obj, const char *nam= e, Visitor *v, bool object_property_set(Object *obj, const char *name, Visitor *v, Error **errp) { - Error *err =3D NULL; + ERRP_GUARD(); ObjectProperty *prop =3D object_property_find_err(obj, name, errp); =20 if (prop =3D=3D NULL) { @@ -1400,9 +1400,8 @@ bool object_property_set(Object *obj, const char *nam= e, Visitor *v, error_setg(errp, QERR_PERMISSION_DENIED); return false; } - prop->set(obj, v, name, prop->opaque, &err); - error_propagate(errp, err); - return !err; + prop->set(obj, v, name, prop->opaque, errp); + return !*errp; } =20 bool object_property_set_str(Object *obj, const char *name, diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index ad9b56b59a..3b61c195c5 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -46,25 +46,18 @@ static void object_set_properties_from_qdict(Object *ob= j, const QDict *qdict, Visitor *v, Error **errp) { const QDictEntry *e; - Error *local_err =3D NULL; =20 - if (!visit_start_struct(v, NULL, NULL, 0, &local_err)) { - goto out; + if (!visit_start_struct(v, NULL, NULL, 0, errp)) { + return; } for (e =3D qdict_first(qdict); e; e =3D qdict_next(qdict, e)) { - if (!object_property_set(obj, e->key, v, &local_err)) { - break; + if (!object_property_set(obj, e->key, v, errp)) { + goto out; } } - if (!local_err) { - visit_check_struct(v, &local_err); - } - visit_end_struct(v, NULL); - + visit_check_struct(v, errp); out: - if (local_err) { - error_propagate(errp, local_err); - } + visit_end_struct(v, NULL); } =20 void object_set_properties_from_keyval(Object *obj, const QDict *qdict, --=20 2.31.1