From patchwork Tue May 5 15:29:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6076CC47254 for ; Tue, 5 May 2020 15:31:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25A6D2078C for ; Tue, 5 May 2020 15:31:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UlKqJ3hT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25A6D2078C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVzXV-00057C-7b for qemu-devel@archiver.kernel.org; Tue, 05 May 2020 11:31:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVzVm-0003Jb-9Z for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:34 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59218 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVzVk-0007Po-Fb for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588692570; h=from:from: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; bh=G6n1q1CKUBB5YRA3C1f4HwmKosrRk5NH0rHk1l84Q0A=; b=UlKqJ3hTiErm6D5/NDDc5NH6L2E/uhbUgtCpbdXMcPWxfbGhUlI0poCACCIvFnXh58odm5 nzuQcAZQNcLAFcOJxCNZSJWP/UFhm0zsnSIPyZkzotvQSLmFh0DM6sU6A0l6uW2qeZfnzf xic4KOGwnEDWVPlCm33UkqMWVSijifo= 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-458-jLqyyOCtOEmHTNdRH0Y5SA-1; Tue, 05 May 2020 11:29:28 -0400 X-MC-Unique: jLqyyOCtOEmHTNdRH0Y5SA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5C8A461 for ; Tue, 5 May 2020 15:29:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EFC82B15E; Tue, 5 May 2020 15:29:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 30E0511358BD; Tue, 5 May 2020 17:29:26 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 01/18] qom: Clearer reference counting in object_initialize_childv() Date: Tue, 5 May 2020 17:29:09 +0200 Message-Id: <20200505152926.18877-2-armbru@redhat.com> In-Reply-To: <20200505152926.18877-1-armbru@redhat.com> References: <20200505152926.18877-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 00:37:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com, philmd@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Paolo Bonzini --- qom/object.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qom/object.c b/qom/object.c index be700e831f..5511649502 100644 --- a/qom/object.c +++ b/qom/object.c @@ -571,18 +571,18 @@ void object_initialize_childv(Object *parentobj, const char *propname, } } +out: /* - * Since object_property_add_child added a reference to the child object, - * we can drop the reference added by object_initialize(), so the child - * property will own the only reference to the object. + * We want @obj's reference to be 1 on success, 0 on failure. + * On success, it's 2: one taken by object_initialize(), and one + * by object_property_add_child(). + * On failure in object_initialize() or earlier, it's 1. + * On failure afterwards, it's also 1: object_unparent() releases + * the reference taken by object_property_add_child(). */ object_unref(obj); -out: - if (local_err) { - error_propagate(errp, local_err); - object_unref(obj); - } + error_propagate(errp, local_err); } static inline bool object_property_is_child(ObjectProperty *prop) From patchwork Tue May 5 15:29:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01040C47247 for ; Tue, 5 May 2020 15:41:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6FF3206B9 for ; Tue, 5 May 2020 15:41:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dUecfpHI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6FF3206B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVzgr-0007ml-N8 for qemu-devel@archiver.kernel.org; Tue, 05 May 2020 11:41:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVzVv-0003UM-Tj for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:43 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:38228 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVzVo-0007TF-EE for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588692575; h=from:from: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; bh=y+PHnR57qBTbd2B/WmRXaGvR865UwVJQqPHggRUV1/M=; b=dUecfpHILl7lxewxds0HJsIEd8zoaXXEyOoBxbvH5WP2f5mVZ/O6Xxu7Hq9xWJWfqF10de 4NjAhf3gVaDBhz1B4O1j8/ZKT9KNAzLbjQuG5waEJAd8x3Zp4QW8X7JtdQQiHBAxVaj0u2 k5sgvR4CYVb1zu/i1KG2104Ii6IFhfM= 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-nEPwQrdJO1GcS8UNhDApeQ-1; Tue, 05 May 2020 11:29:28 -0400 X-MC-Unique: nEPwQrdJO1GcS8UNhDApeQ-1 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 E3EFE800687 for ; Tue, 5 May 2020 15:29:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB33C60BF4; Tue, 5 May 2020 15:29:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3734A11358BF; Tue, 5 May 2020 17:29:26 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 03/18] qom: Drop object_property_del_child()'s unused parameter @errp Date: Tue, 5 May 2020 17:29:11 +0200 Message-Id: <20200505152926.18877-4-armbru@redhat.com> In-Reply-To: <20200505152926.18877-1-armbru@redhat.com> References: <20200505152926.18877-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 00:37:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com, philmd@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Paolo Bonzini --- qom/object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qom/object.c b/qom/object.c index 07762cc331..3d65658059 100644 --- a/qom/object.c +++ b/qom/object.c @@ -614,7 +614,7 @@ static void object_property_del_all(Object *obj) g_hash_table_unref(obj->properties); } -static void object_property_del_child(Object *obj, Object *child, Error **errp) +static void object_property_del_child(Object *obj, Object *child) { ObjectProperty *prop; GHashTableIter iter; @@ -644,7 +644,7 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp) void object_unparent(Object *obj) { if (obj->parent) { - object_property_del_child(obj->parent, obj, NULL); + object_property_del_child(obj->parent, obj); } } From patchwork Tue May 5 15:29:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC123C47247 for ; Tue, 5 May 2020 15:35:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7701820746 for ; Tue, 5 May 2020 15:35:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Av724U2P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7701820746 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVzbD-0000pq-Io for qemu-devel@archiver.kernel.org; Tue, 05 May 2020 11:35:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVzVo-0003KB-B5 for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:36 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28722 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVzVl-0007Qe-DM for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588692572; h=from:from: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; bh=McJcjHtSWnBjEEs2H2Yvzyf7jr3Q5e2gxUKSZdf2eOU=; b=Av724U2P/pgFYcGLBhkdIpEnNSY2CFT68UNrmADU9MxRNyIAEyLfyjge5Z4smrwnCJpw1w TzzP67jr3fqqMeO+49uXHOlYMS29f4hoqStUWP7Cg25V69EqZl/uFH4+UsqUEcid1lz6w0 MbW15z4iHnyqF1Cc3yECzSVIpjMAdZI= 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-106-uXttmxrKOj6AwPAUrzFfJw-1; Tue, 05 May 2020 11:29:30 -0400 X-MC-Unique: uXttmxrKOj6AwPAUrzFfJw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7A29953 for ; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F0E12B141; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3D84311358C1; Tue, 5 May 2020 17:29:26 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 05/18] qom: Drop convenience method object_property_get_uint16List() Date: Tue, 5 May 2020 17:29:13 +0200 Message-Id: <20200505152926.18877-6-armbru@redhat.com> In-Reply-To: <20200505152926.18877-1-armbru@redhat.com> References: <20200505152926.18877-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 03:48:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com, philmd@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" qom/object.c provides object_property_get_TYPE() and object_property_set_TYPE() for a number of common types. These are all convenience wrappers around object_property_get_qobject() and object_property_set_qobject(). Except for object_property_get_uint16List(), which is unusual in two ways: * It bypasses object_property_get_qobject(). Fixable; the previous commit did it for object_property_get_enum()) * It stores the value through a parameter. Its contract claims it returns the value, like the other functions do. Also fixable. Fixing is not worthwhile, though: object_property_get_uint16List() has seen exactly one user in six years. Convert the lone user to do its job with the generic object_property_get_qobject(), and drop object_property_get_qobject(). Signed-off-by: Markus Armbruster --- include/qom/object.h | 14 -------------- hw/core/machine-qmp-cmds.c | 16 +++++++++++++--- qom/object.c | 23 ----------------------- 3 files changed, 13 insertions(+), 40 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index ccfa82e33d..4df9ecebad 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1320,20 +1320,6 @@ uint64_t object_property_get_uint(Object *obj, const char *name, int object_property_get_enum(Object *obj, const char *name, const char *typename, Error **errp); -/** - * object_property_get_uint16List: - * @obj: the object - * @name: the name of the property - * @list: the returned int list - * @errp: returns an error if this function fails - * - * Returns: the value of the property, converted to integers, or - * undefined if an error occurs (including when the property value is not - * an list of integers). - */ -void object_property_get_uint16List(Object *obj, const char *name, - uint16List **list, Error **errp); - /** * object_property_set: * @obj: the object diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index eed5aeb2f7..2c5da8413d 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -11,9 +11,13 @@ #include "cpu.h" #include "hw/boards.h" #include "qapi/error.h" +#include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-machine.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qobject.h" +#include "qapi/qobject-input-visitor.h" #include "qemu/main-loop.h" +#include "qom/qom-qobject.h" #include "sysemu/hostmem.h" #include "sysemu/hw_accel.h" #include "sysemu/numa.h" @@ -303,6 +307,8 @@ static int query_memdev(Object *obj, void *opaque) { MemdevList **list = opaque; MemdevList *m = NULL; + QObject *host_nodes; + Visitor *v; if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) { m = g_malloc0(sizeof(*m)); @@ -325,9 +331,13 @@ static int query_memdev(Object *obj, void *opaque) "policy", "HostMemPolicy", &error_abort); - object_property_get_uint16List(obj, "host-nodes", - &m->value->host_nodes, - &error_abort); + host_nodes = object_property_get_qobject(obj, + "host-nodes", + &error_abort); + v = qobject_input_visitor_new(host_nodes); + visit_type_uint16List(v, NULL, &m->value->host_nodes, &error_abort); + visit_free(v); + qobject_unref(host_nodes); m->next = *list; *list = m; diff --git a/qom/object.c b/qom/object.c index b374af302c..54a26ed16a 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1550,29 +1550,6 @@ int object_property_get_enum(Object *obj, const char *name, return ret; } -void object_property_get_uint16List(Object *obj, const char *name, - uint16List **list, Error **errp) -{ - Error *err = NULL; - Visitor *v; - char *str; - - v = string_output_visitor_new(false, &str); - object_property_get(obj, v, name, &err); - if (err) { - error_propagate(errp, err); - goto out; - } - visit_complete(v, &str); - visit_free(v); - v = string_input_visitor_new(str); - visit_type_uint16List(v, NULL, list, errp); - - g_free(str); -out: - visit_free(v); -} - void object_property_parse(Object *obj, const char *string, const char *name, Error **errp) { From patchwork Tue May 5 15:29:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E72B8C47247 for ; Tue, 5 May 2020 15:43:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C8A4206B9 for ; Tue, 5 May 2020 15:43:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fOxE69ty" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C8A4206B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVziy-0002nD-HN for qemu-devel@archiver.kernel.org; Tue, 05 May 2020 11:43:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVzVw-0003Wy-64 for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:44 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:41503 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVzVn-0007R5-9W for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588692572; h=from:from: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; bh=4w7IrnCXfuJRpn2Pwo4QWstitbRFNDkUmnPTKONht1E=; b=fOxE69tyC0+dbwNRneZv0kA9SrBlnsWOzbp998J3k4q+T7uHxKtjwR/e4JNixD4f0JGk3q O8/1Z+agtCYuivli9TK0QAgHHPexCRtWCNMdME5q3iuwvYcxoCXB6z/+JTx/sQk6eDvqId r0mRvlz8Lk0o34KzbuA7eiuR1cNejzM= 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-508-x42_PInpN6KRsYeJsEA54Q-1; Tue, 05 May 2020 11:29:30 -0400 X-MC-Unique: x42_PInpN6KRsYeJsEA54Q-1 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 D4600461 for ; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 288CA165F6; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 44E9411358C3; Tue, 5 May 2020 17:29:26 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 07/18] qom: Drop object_property_set_description() parameter @errp Date: Tue, 5 May 2020 17:29:15 +0200 Message-Id: <20200505152926.18877-8-armbru@redhat.com> In-Reply-To: <20200505152926.18877-1-armbru@redhat.com> References: <20200505152926.18877-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 03:48:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com, philmd@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" object_property_set_description() and object_class_property_set_description() fail only when property @name is not found. There are 85 calls of object_property_set_description() and object_class_property_set_description(). None of them can fail: * 84 immediately follow the creation of the property. * The one in spapr_rng_instance_init() refers to a property created in spapr_rng_class_init(), from spapr_rng_properties[]. Every one of them still gets to decide what to pass for @errp. 51 calls pass &error_abort, 32 calls pass NULL, one receives the error and propagates it to &error_abort, and one propagates it to &error_fatal. I'm actually surprised none of them violates the Error API. What are we gaining by letting callers handle the "property not found" error? Use when the property is not known to exist is simpler: you don't have to guard the call with a check. We haven't found such a use in 5+ years. Until we do, let's make life a bit simpler and drop the @errp parameter. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Paolo Bonzini --- include/qom/object.h | 6 ++---- accel/kvm/kvm-all.c | 4 ++-- accel/tcg/tcg-all.c | 2 +- backends/hostmem-memfd.c | 9 +++------ backends/hostmem.c | 16 +++++++-------- hw/arm/aspeed.c | 2 +- hw/arm/vexpress.c | 6 ++---- hw/arm/virt.c | 20 +++++++------------ hw/arm/xlnx-zcu102.c | 6 ++---- hw/core/machine.c | 41 ++++++++++++++++++-------------------- hw/core/qdev.c | 6 ++---- hw/i386/microvm.c | 14 ++++++------- hw/i386/pc.c | 2 +- hw/i386/x86.c | 6 +++--- hw/ppc/mac_newworld.c | 3 +-- hw/ppc/pnv.c | 3 +-- hw/ppc/spapr.c | 21 ++++++++----------- hw/ppc/spapr_caps.c | 6 +----- hw/ppc/spapr_rng.c | 3 +-- hw/riscv/sifive_u.c | 5 ++--- hw/s390x/css-bridge.c | 3 +-- hw/s390x/s390-virtio-ccw.c | 9 +++------ hw/sparc/sun4m.c | 3 +-- hw/xen/xen-common.c | 2 +- qom/object.c | 19 ++++-------------- target/arm/cpu64.c | 3 +-- target/arm/kvm.c | 2 +- target/i386/sev.c | 6 +++--- target/ppc/compat.c | 2 +- target/s390x/cpu_models.c | 4 ++-- 30 files changed, 91 insertions(+), 143 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 0ea5808432..1f0386a231 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1813,16 +1813,14 @@ ObjectProperty *object_property_add_const_link(Object *obj, const char *name, * @obj: the object owning the property * @name: the name of the property * @description: the description of the property on the object - * @errp: if an error occurs, a pointer to an area to store the error * * Set an object property's description. * */ void object_property_set_description(Object *obj, const char *name, - const char *description, Error **errp); + const char *description); void object_class_property_set_description(ObjectClass *klass, const char *name, - const char *description, - Error **errp); + const char *description); /** * object_child_foreach: diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 439a4efe52..2fb6099cf2 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -3077,13 +3077,13 @@ static void kvm_accel_class_init(ObjectClass *oc, void *data) NULL, kvm_set_kernel_irqchip, NULL, NULL, &error_abort); object_class_property_set_description(oc, "kernel-irqchip", - "Configure KVM in-kernel irqchip", &error_abort); + "Configure KVM in-kernel irqchip"); object_class_property_add(oc, "kvm-shadow-mem", "int", kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem, NULL, NULL, &error_abort); object_class_property_set_description(oc, "kvm-shadow-mem", - "KVM shadow MMU size", &error_abort); + "KVM shadow MMU size"); } static const TypeInfo kvm_accel_type = { diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index acfdcfdf59..3398a56ef9 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -210,7 +210,7 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) tcg_get_tb_size, tcg_set_tb_size, NULL, NULL, &error_abort); object_class_property_set_description(oc, "tb-size", - "TCG translation block cache size", &error_abort); + "TCG translation block cache size"); } diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 74ba9879c4..5991f31459 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -144,23 +144,20 @@ memfd_backend_class_init(ObjectClass *oc, void *data) memfd_backend_set_hugetlb, &error_abort); object_class_property_set_description(oc, "hugetlb", - "Use huge pages", - &error_abort); + "Use huge pages"); object_class_property_add(oc, "hugetlbsize", "int", memfd_backend_get_hugetlbsize, memfd_backend_set_hugetlbsize, NULL, NULL, &error_abort); object_class_property_set_description(oc, "hugetlbsize", - "Huge pages size (ex: 2M, 1G)", - &error_abort); + "Huge pages size (ex: 2M, 1G)"); } object_class_property_add_bool(oc, "seal", memfd_backend_get_seal, memfd_backend_set_seal, &error_abort); object_class_property_set_description(oc, "seal", - "Seal growing & shrinking", - &error_abort); + "Seal growing & shrinking"); } static const TypeInfo memfd_backend_info = { diff --git a/backends/hostmem.c b/backends/hostmem.c index 327f9eebc3..946d176435 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -465,46 +465,46 @@ host_memory_backend_class_init(ObjectClass *oc, void *data) host_memory_backend_get_merge, host_memory_backend_set_merge, &error_abort); object_class_property_set_description(oc, "merge", - "Mark memory as mergeable", &error_abort); + "Mark memory as mergeable"); object_class_property_add_bool(oc, "dump", host_memory_backend_get_dump, host_memory_backend_set_dump, &error_abort); object_class_property_set_description(oc, "dump", - "Set to 'off' to exclude from core dump", &error_abort); + "Set to 'off' to exclude from core dump"); object_class_property_add_bool(oc, "prealloc", host_memory_backend_get_prealloc, host_memory_backend_set_prealloc, &error_abort); object_class_property_set_description(oc, "prealloc", - "Preallocate memory", &error_abort); + "Preallocate memory"); object_class_property_add(oc, "prealloc-threads", "int", host_memory_backend_get_prealloc_threads, host_memory_backend_set_prealloc_threads, NULL, NULL, &error_abort); object_class_property_set_description(oc, "prealloc-threads", - "Number of CPU threads to use for prealloc", &error_abort); + "Number of CPU threads to use for prealloc"); object_class_property_add(oc, "size", "int", host_memory_backend_get_size, host_memory_backend_set_size, NULL, NULL, &error_abort); object_class_property_set_description(oc, "size", - "Size of the memory region (ex: 500M)", &error_abort); + "Size of the memory region (ex: 500M)"); object_class_property_add(oc, "host-nodes", "int", host_memory_backend_get_host_nodes, host_memory_backend_set_host_nodes, NULL, NULL, &error_abort); object_class_property_set_description(oc, "host-nodes", - "Binds memory to the list of NUMA host nodes", &error_abort); + "Binds memory to the list of NUMA host nodes"); object_class_property_add_enum(oc, "policy", "HostMemPolicy", &HostMemPolicy_lookup, host_memory_backend_get_policy, host_memory_backend_set_policy, &error_abort); object_class_property_set_description(oc, "policy", - "Set the NUMA policy", &error_abort); + "Set the NUMA policy"); object_class_property_add_bool(oc, "share", host_memory_backend_get_share, host_memory_backend_set_share, &error_abort); object_class_property_set_description(oc, "share", - "Mark the memory as private to QEMU or shared", &error_abort); + "Mark the memory as private to QEMU or shared"); object_class_property_add_bool(oc, "x-use-canonical-path-for-ramblock-id", host_memory_backend_get_use_canonical_path, host_memory_backend_set_use_canonical_path, &error_abort); diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index a6a2102a93..b9a34cab75 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -422,7 +422,7 @@ static void aspeed_machine_class_props_init(ObjectClass *oc) aspeed_get_mmio_exec, aspeed_set_mmio_exec, &error_abort); object_class_property_set_description(oc, "execute-in-place", - "boot directly from CE0 flash device", &error_abort); + "boot directly from CE0 flash device"); } static void aspeed_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index ed683eeea5..5372ab6c9b 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -752,8 +752,7 @@ static void vexpress_instance_init(Object *obj) vexpress_set_secure, NULL); object_property_set_description(obj, "secure", "Set on/off to enable/disable the ARM " - "Security Extensions (TrustZone)", - NULL); + "Security Extensions (TrustZone)"); } static void vexpress_a15_instance_init(Object *obj) @@ -770,8 +769,7 @@ static void vexpress_a15_instance_init(Object *obj) object_property_set_description(obj, "virtualization", "Set on/off to enable/disable the ARM " "Virtualization Extensions " - "(defaults to same as 'secure')", - NULL); + "(defaults to same as 'secure')"); } static void vexpress_a9_instance_init(Object *obj) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 171e6908ec..e9c6b9a340 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2258,7 +2258,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) virt_get_acpi, virt_set_acpi, NULL, NULL, &error_abort); object_class_property_set_description(oc, "acpi", - "Enable ACPI", &error_abort); + "Enable ACPI"); } static void virt_instance_init(Object *obj) @@ -2275,8 +2275,7 @@ static void virt_instance_init(Object *obj) virt_set_secure, NULL); object_property_set_description(obj, "secure", "Set on/off to enable/disable the ARM " - "Security Extensions (TrustZone)", - NULL); + "Security Extensions (TrustZone)"); /* EL2 is also disabled by default, for similar reasons */ vms->virt = false; @@ -2285,8 +2284,7 @@ static void virt_instance_init(Object *obj) object_property_set_description(obj, "virtualization", "Set on/off to enable/disable emulating a " "guest CPU which implements the ARM " - "Virtualization Extensions", - NULL); + "Virtualization Extensions"); /* High memory is enabled by default */ vms->highmem = true; @@ -2294,15 +2292,13 @@ static void virt_instance_init(Object *obj) virt_set_highmem, NULL); object_property_set_description(obj, "highmem", "Set on/off to enable/disable using " - "physical address space above 32 bits", - NULL); + "physical address space above 32 bits"); vms->gic_version = VIRT_GIC_VERSION_NOSEL; object_property_add_str(obj, "gic-version", virt_get_gic_version, virt_set_gic_version, NULL); object_property_set_description(obj, "gic-version", "Set GIC version. " - "Valid values are 2, 3, host and max", - NULL); + "Valid values are 2, 3, host and max"); vms->highmem_ecam = !vmc->no_highmem_ecam; @@ -2315,8 +2311,7 @@ static void virt_instance_init(Object *obj) virt_set_its, NULL); object_property_set_description(obj, "its", "Set on/off to enable/disable " - "ITS instantiation", - NULL); + "ITS instantiation"); } /* Default disallows iommu instantiation */ @@ -2324,8 +2319,7 @@ static void virt_instance_init(Object *obj) object_property_add_str(obj, "iommu", virt_get_iommu, virt_set_iommu, NULL); object_property_set_description(obj, "iommu", "Set the IOMMU type. " - "Valid values are none and smmuv3", - NULL); + "Valid values are none and smmuv3"); vms->irqmap = a15irqmap; diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index a798e228b7..808fdae804 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -212,8 +212,7 @@ static void xlnx_zcu102_machine_instance_init(Object *obj) zcu102_set_secure, NULL); object_property_set_description(obj, "secure", "Set on/off to enable/disable the ARM " - "Security Extensions (TrustZone)", - NULL); + "Security Extensions (TrustZone)"); /* Default to virt (EL2) being disabled */ s->virt = false; @@ -222,8 +221,7 @@ static void xlnx_zcu102_machine_instance_init(Object *obj) object_property_set_description(obj, "virtualization", "Set on/off to enable/disable emulating a " "guest CPU which implements the ARM " - "Virtualization Extensions", - NULL); + "Virtualization Extensions"); } static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/core/machine.c b/hw/core/machine.c index c1a444cb75..39310acf36 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -786,83 +786,82 @@ static void machine_class_init(ObjectClass *oc, void *data) object_class_property_add_str(oc, "kernel", machine_get_kernel, machine_set_kernel, &error_abort); object_class_property_set_description(oc, "kernel", - "Linux kernel image file", &error_abort); + "Linux kernel image file"); object_class_property_add_str(oc, "initrd", machine_get_initrd, machine_set_initrd, &error_abort); object_class_property_set_description(oc, "initrd", - "Linux initial ramdisk file", &error_abort); + "Linux initial ramdisk file"); object_class_property_add_str(oc, "append", machine_get_append, machine_set_append, &error_abort); object_class_property_set_description(oc, "append", - "Linux kernel command line", &error_abort); + "Linux kernel command line"); object_class_property_add_str(oc, "dtb", machine_get_dtb, machine_set_dtb, &error_abort); object_class_property_set_description(oc, "dtb", - "Linux kernel device tree file", &error_abort); + "Linux kernel device tree file"); object_class_property_add_str(oc, "dumpdtb", machine_get_dumpdtb, machine_set_dumpdtb, &error_abort); object_class_property_set_description(oc, "dumpdtb", - "Dump current dtb to a file and quit", &error_abort); + "Dump current dtb to a file and quit"); object_class_property_add(oc, "phandle-start", "int", machine_get_phandle_start, machine_set_phandle_start, NULL, NULL, &error_abort); object_class_property_set_description(oc, "phandle-start", - "The first phandle ID we may generate dynamically", &error_abort); + "The first phandle ID we may generate dynamically"); object_class_property_add_str(oc, "dt-compatible", machine_get_dt_compatible, machine_set_dt_compatible, &error_abort); object_class_property_set_description(oc, "dt-compatible", - "Overrides the \"compatible\" property of the dt root node", - &error_abort); + "Overrides the \"compatible\" property of the dt root node"); object_class_property_add_bool(oc, "dump-guest-core", machine_get_dump_guest_core, machine_set_dump_guest_core, &error_abort); object_class_property_set_description(oc, "dump-guest-core", - "Include guest memory in a core dump", &error_abort); + "Include guest memory in a core dump"); object_class_property_add_bool(oc, "mem-merge", machine_get_mem_merge, machine_set_mem_merge, &error_abort); object_class_property_set_description(oc, "mem-merge", - "Enable/disable memory merge support", &error_abort); + "Enable/disable memory merge support"); object_class_property_add_bool(oc, "usb", machine_get_usb, machine_set_usb, &error_abort); object_class_property_set_description(oc, "usb", - "Set on/off to enable/disable usb", &error_abort); + "Set on/off to enable/disable usb"); object_class_property_add_bool(oc, "graphics", machine_get_graphics, machine_set_graphics, &error_abort); object_class_property_set_description(oc, "graphics", - "Set on/off to enable/disable graphics emulation", &error_abort); + "Set on/off to enable/disable graphics emulation"); object_class_property_add_str(oc, "firmware", machine_get_firmware, machine_set_firmware, &error_abort); object_class_property_set_description(oc, "firmware", - "Firmware image", &error_abort); + "Firmware image"); object_class_property_add_bool(oc, "suppress-vmdesc", machine_get_suppress_vmdesc, machine_set_suppress_vmdesc, &error_abort); object_class_property_set_description(oc, "suppress-vmdesc", - "Set on to disable self-describing migration", &error_abort); + "Set on to disable self-describing migration"); object_class_property_add_bool(oc, "enforce-config-section", machine_get_enforce_config_section, machine_set_enforce_config_section, &error_abort); object_class_property_set_description(oc, "enforce-config-section", - "Set on to enforce configuration section migration", &error_abort); + "Set on to enforce configuration section migration"); object_class_property_add_str(oc, "memory-encryption", machine_get_memory_encryption, machine_set_memory_encryption, &error_abort); object_class_property_set_description(oc, "memory-encryption", - "Set memory encryption object to use", &error_abort); + "Set memory encryption object to use"); } static void machine_class_base_init(ObjectClass *oc, void *data) @@ -895,7 +894,7 @@ static void machine_initfn(Object *obj) &error_abort); object_property_set_description(obj, "nvdimm", "Set on/off to enable/disable " - "NVDIMM instantiation", NULL); + "NVDIMM instantiation"); object_property_add_str(obj, "nvdimm-persistence", machine_get_nvdimm_persistence, @@ -903,8 +902,7 @@ static void machine_initfn(Object *obj) &error_abort); object_property_set_description(obj, "nvdimm-persistence", "Set NVDIMM persistence" - "Valid values are cpu, mem-ctrl", - NULL); + "Valid values are cpu, mem-ctrl"); } if (mc->cpu_index_to_instance_props && mc->get_default_cpu_node_id) { @@ -915,7 +913,7 @@ static void machine_initfn(Object *obj) object_property_set_description(obj, "hmat", "Set on/off to enable/disable " "ACPI Heterogeneous Memory Attribute " - "Table (HMAT)", NULL); + "Table (HMAT)"); } object_property_add_str(obj, "memory-backend", @@ -923,8 +921,7 @@ static void machine_initfn(Object *obj) &error_abort); object_property_set_description(obj, "memory-backend", "Set RAM backend" - "Valid value is ID of hostmem based backend", - &error_abort); + "Valid value is ID of hostmem based backend"); /* Register notifier when init is done for sysbus sanity checks */ ms->sysbus_notifier.notify = machine_init_notify; diff --git a/hw/core/qdev.c b/hw/core/qdev.c index dd77a56067..ea7118ab0e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -775,8 +775,7 @@ void qdev_property_add_static(DeviceState *dev, Property *prop) prop, &error_abort); object_property_set_description(obj, prop->name, - prop->info->description, - &error_abort); + prop->info->description); if (prop->set_default) { prop->info->set_default_value(op, prop); @@ -805,8 +804,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop) } } object_class_property_set_description(oc, prop->name, - prop->info->description, - &error_abort); + prop->info->description); } /* @qdev_alias_all_properties - Add alias properties to the source object for diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 38d8e51703..76aaa7a8d8 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -512,36 +512,35 @@ static void microvm_class_init(ObjectClass *oc, void *data) microvm_machine_set_pic, NULL, NULL, &error_abort); object_class_property_set_description(oc, MICROVM_MACHINE_PIC, - "Enable i8259 PIC", &error_abort); + "Enable i8259 PIC"); object_class_property_add(oc, MICROVM_MACHINE_PIT, "OnOffAuto", microvm_machine_get_pit, microvm_machine_set_pit, NULL, NULL, &error_abort); object_class_property_set_description(oc, MICROVM_MACHINE_PIT, - "Enable i8254 PIT", &error_abort); + "Enable i8254 PIT"); object_class_property_add(oc, MICROVM_MACHINE_RTC, "OnOffAuto", microvm_machine_get_rtc, microvm_machine_set_rtc, NULL, NULL, &error_abort); object_class_property_set_description(oc, MICROVM_MACHINE_RTC, - "Enable MC146818 RTC", &error_abort); + "Enable MC146818 RTC"); object_class_property_add_bool(oc, MICROVM_MACHINE_ISA_SERIAL, microvm_machine_get_isa_serial, microvm_machine_set_isa_serial, &error_abort); object_class_property_set_description(oc, MICROVM_MACHINE_ISA_SERIAL, - "Set off to disable the instantiation an ISA serial port", - &error_abort); + "Set off to disable the instantiation an ISA serial port"); object_class_property_add_bool(oc, MICROVM_MACHINE_OPTION_ROMS, microvm_machine_get_option_roms, microvm_machine_set_option_roms, &error_abort); object_class_property_set_description(oc, MICROVM_MACHINE_OPTION_ROMS, - "Set off to disable loading option ROMs", &error_abort); + "Set off to disable loading option ROMs"); object_class_property_add_bool(oc, MICROVM_MACHINE_AUTO_KERNEL_CMDLINE, microvm_machine_get_auto_kernel_cmdline, @@ -549,8 +548,7 @@ static void microvm_class_init(ObjectClass *oc, void *data) &error_abort); object_class_property_set_description(oc, MICROVM_MACHINE_AUTO_KERNEL_CMDLINE, - "Set off to disable adding virtio-mmio devices to the kernel cmdline", - &error_abort); + "Set off to disable adding virtio-mmio devices to the kernel cmdline"); } static const TypeInfo microvm_machine_info = { diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f6b8431c8b..37c16de1df 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1968,7 +1968,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pc_machine_get_vmport, pc_machine_set_vmport, NULL, NULL, &error_abort); object_class_property_set_description(oc, PC_MACHINE_VMPORT, - "Enable vmport (pc & q35)", &error_abort); + "Enable vmport (pc & q35)"); object_class_property_add_bool(oc, PC_MACHINE_SMBUS, pc_machine_get_smbus, pc_machine_set_smbus, &error_abort); diff --git a/hw/i386/x86.c b/hw/i386/x86.c index b82770024c..e2bf601273 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -984,19 +984,19 @@ static void x86_machine_class_init(ObjectClass *oc, void *data) x86_machine_get_max_ram_below_4g, x86_machine_set_max_ram_below_4g, NULL, NULL, &error_abort); object_class_property_set_description(oc, X86_MACHINE_MAX_RAM_BELOW_4G, - "Maximum ram below the 4G boundary (32bit boundary)", &error_abort); + "Maximum ram below the 4G boundary (32bit boundary)"); object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto", x86_machine_get_smm, x86_machine_set_smm, NULL, NULL, &error_abort); object_class_property_set_description(oc, X86_MACHINE_SMM, - "Enable SMM", &error_abort); + "Enable SMM"); object_class_property_add(oc, X86_MACHINE_ACPI, "OnOffAuto", x86_machine_get_acpi, x86_machine_set_acpi, NULL, NULL, &error_abort); object_class_property_set_description(oc, X86_MACHINE_ACPI, - "Enable ACPI", &error_abort); + "Enable ACPI"); } static const TypeInfo x86_machine_info = { diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 428cf63578..55d1419442 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -631,8 +631,7 @@ static void core99_instance_init(Object *obj) core99_set_via_config, NULL); object_property_set_description(obj, "via", "Set VIA configuration. " - "Valid values are cuda, pmu and pmu-adb", - NULL); + "Valid values are cuda, pmu and pmu-adb"); return; } diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index c9cb6fa357..71b08e2ae7 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -2002,8 +2002,7 @@ static void pnv_machine_class_init(ObjectClass *oc, void *data) pnv_machine_get_hb, pnv_machine_set_hb, &error_abort); object_class_property_set_description(oc, "hb-mode", - "Use a hostboot like boot loader", - NULL); + "Use a hostboot like boot loader"); } #define DEFINE_PNV8_CHIP_TYPE(type, class_initfn) \ diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9a2bd501aa..91138e7c67 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3317,8 +3317,7 @@ static void spapr_instance_init(Object *obj) object_property_add_str(obj, "kvm-type", spapr_get_kvm_type, spapr_set_kvm_type, NULL); object_property_set_description(obj, "kvm-type", - "Specifies the KVM virtualization mode (HV, PR)", - NULL); + "Specifies the KVM virtualization mode (HV, PR)"); object_property_add_bool(obj, "modern-hotplug-events", spapr_get_modern_hotplug_events, spapr_set_modern_hotplug_events, @@ -3326,8 +3325,7 @@ static void spapr_instance_init(Object *obj) object_property_set_description(obj, "modern-hotplug-events", "Use dedicated hotplug event mechanism in" " place of standard EPOW events when possible" - " (required for memory hot-unplug support)", - NULL); + " (required for memory hot-unplug support)"); ppc_compat_add_property(obj, "max-cpu-compat", &spapr->max_compat_pvr, "Maximum permitted CPU compatibility mode", &error_fatal); @@ -3335,14 +3333,13 @@ static void spapr_instance_init(Object *obj) object_property_add_str(obj, "resize-hpt", spapr_get_resize_hpt, spapr_set_resize_hpt, NULL); object_property_set_description(obj, "resize-hpt", - "Resizing of the Hash Page Table (enabled, disabled, required)", - NULL); + "Resizing of the Hash Page Table (enabled, disabled, required)"); object_property_add_uint32_ptr(obj, "vsmt", &spapr->vsmt, OBJ_PROP_FLAG_READWRITE, &error_abort); object_property_set_description(obj, "vsmt", "Virtual SMT: KVM behaves as if this were" - " the host's SMT mode", &error_abort); + " the host's SMT mode"); object_property_add_bool(obj, "vfio-no-msix-emulation", spapr_get_msix_emulation, NULL, NULL); @@ -3352,27 +3349,25 @@ static void spapr_instance_init(Object *obj) &error_abort); object_property_set_description(obj, "kernel-addr", stringify(KERNEL_LOAD_ADDR) - " for -kernel is the default", - NULL); + " for -kernel is the default"); spapr->kernel_addr = KERNEL_LOAD_ADDR; /* The machine class defines the default interrupt controller mode */ spapr->irq = smc->irq; object_property_add_str(obj, "ic-mode", spapr_get_ic_mode, spapr_set_ic_mode, NULL); object_property_set_description(obj, "ic-mode", - "Specifies the interrupt controller mode (xics, xive, dual)", - NULL); + "Specifies the interrupt controller mode (xics, xive, dual)"); object_property_add_str(obj, "host-model", spapr_get_host_model, spapr_set_host_model, &error_abort); object_property_set_description(obj, "host-model", - "Host model to advertise in guest device tree", &error_abort); + "Host model to advertise in guest device tree"); object_property_add_str(obj, "host-serial", spapr_get_host_serial, spapr_set_host_serial, &error_abort); object_property_set_description(obj, "host-serial", - "Host serial number to advertise in guest device tree", &error_abort); + "Host serial number to advertise in guest device tree"); } static void spapr_machine_finalizefn(Object *obj) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index eb54f94227..0870961fc9 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -845,12 +845,8 @@ void spapr_caps_add_properties(SpaprMachineClass *smc, Error **errp) } desc = g_strdup_printf("%s", cap->description); - object_class_property_set_description(klass, name, desc, &local_err); + object_class_property_set_description(klass, name, desc); g_free(name); g_free(desc); - if (local_err) { - error_propagate(errp, local_err); - return; - } } } diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c index e8e8d65ec0..85bf64d68e 100644 --- a/hw/ppc/spapr_rng.c +++ b/hw/ppc/spapr_rng.c @@ -103,8 +103,7 @@ static void spapr_rng_instance_init(Object *obj) } object_property_set_description(obj, "rng", - "ID of the random number generator backend", - NULL); + "ID of the random number generator backend"); } static void spapr_rng_realize(DeviceState *dev, Error **errp) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index bed10fcfa8..da48c958e2 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -445,13 +445,12 @@ static void sifive_u_machine_instance_init(Object *obj) sifive_u_machine_set_start_in_flash, NULL); object_property_set_description(obj, "start-in-flash", "Set on to tell QEMU's ROM to jump to " - "flash. Otherwise QEMU will jump to DRAM", - NULL); + "flash. Otherwise QEMU will jump to DRAM"); s->serial = OTP_SERIAL; object_property_add(obj, "serial", "uint32", sifive_u_machine_get_serial, sifive_u_machine_set_serial, NULL, &s->serial, NULL); - object_property_set_description(obj, "serial", "Board serial number", NULL); + object_property_set_description(obj, "serial", "Board serial number"); } static void sifive_u_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/s390x/css-bridge.c b/hw/s390x/css-bridge.c index a306a78e6c..c9ce06b043 100644 --- a/hw/s390x/css-bridge.c +++ b/hw/s390x/css-bridge.c @@ -144,8 +144,7 @@ static void virtual_css_bridge_class_init(ObjectClass *klass, void *data) prop_get_true, NULL, NULL); object_class_property_set_description(klass, "cssid-unrestricted", "A css device can use any cssid, regardless whether virtual" - " or not (read only, always true)", - NULL); + " or not (read only, always true)"); } static const TypeInfo virtual_css_bridge_info = { diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 45292fb5a8..8643c0baae 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -731,24 +731,21 @@ static inline void s390_machine_initfn(Object *obj) machine_get_aes_key_wrap, machine_set_aes_key_wrap, NULL); object_property_set_description(obj, "aes-key-wrap", - "enable/disable AES key wrapping using the CPACF wrapping key", - NULL); + "enable/disable AES key wrapping using the CPACF wrapping key"); object_property_set_bool(obj, true, "aes-key-wrap", NULL); object_property_add_bool(obj, "dea-key-wrap", machine_get_dea_key_wrap, machine_set_dea_key_wrap, NULL); object_property_set_description(obj, "dea-key-wrap", - "enable/disable DEA key wrapping using the CPACF wrapping key", - NULL); + "enable/disable DEA key wrapping using the CPACF wrapping key"); object_property_set_bool(obj, true, "dea-key-wrap", NULL); object_property_add_str(obj, "loadparm", machine_get_loadparm, machine_set_loadparm, NULL); object_property_set_description(obj, "loadparm", "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted" " to upper case) to pass to machine loader, boot manager," - " and guest kernel", - NULL); + " and guest kernel"); } static const TypeInfo ccw_machine_info = { diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 36ee1a0a3d..7472d24e2c 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -797,8 +797,7 @@ static void ram_initfn(Object *obj) object_property_allow_set_link, OBJ_PROP_LINK_STRONG, &error_abort); object_property_set_description(obj, "memdev", "Set RAM backend" - "Valid value is ID of a hostmem backend", - &error_abort); + "Valid value is ID of a hostmem backend"); } static void ram_class_init(ObjectClass *klass, void *data) diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index a15070f7f6..adaab81ce0 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -201,7 +201,7 @@ static void xen_accel_class_init(ObjectClass *oc, void *data) xen_get_igd_gfx_passthru, xen_set_igd_gfx_passthru, &error_abort); object_class_property_set_description(oc, "igd-passthru", - "Set on/off to enable/disable igd passthrou", &error_abort); + "Set on/off to enable/disable igd passthrou"); } #define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen") diff --git a/qom/object.c b/qom/object.c index 4e5b2ecacd..58a6ec9b1b 100644 --- a/qom/object.c +++ b/qom/object.c @@ -2802,38 +2802,27 @@ object_property_add_alias(Object *obj, const char *name, } object_property_set_description(obj, op->name, - target_prop->description, - &error_abort); + target_prop->description); return op; } void object_property_set_description(Object *obj, const char *name, - const char *description, Error **errp) + const char *description) { ObjectProperty *op; - op = object_property_find(obj, name, errp); - if (!op) { - return; - } - + op = object_property_find(obj, name, &error_abort); g_free(op->description); op->description = g_strdup(description); } void object_class_property_set_description(ObjectClass *klass, const char *name, - const char *description, - Error **errp) + const char *description) { ObjectProperty *op; op = g_hash_table_lookup(klass->properties, name); - if (!op) { - error_setg(errp, "Property '.%s' not found", name); - return; - } - g_free(op->description); op->description = g_strdup(description); } diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 9bdf75b1ab..a435a1f24f 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -781,8 +781,7 @@ static void aarch64_cpu_initfn(Object *obj) aarch64_cpu_set_aarch64, NULL); object_property_set_description(obj, "aarch64", "Set on/off to enable/disable aarch64 " - "execution state ", - NULL); + "execution state "); } static void aarch64_cpu_finalizefn(Object *obj) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 390077c518..1ea2d047e3 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -204,7 +204,7 @@ void kvm_arm_add_vcpu_properties(Object *obj) object_property_set_description(obj, "kvm-no-adjvtime", "Set on to disable the adjustment of " "the virtual counter. VM stopped time " - "will be counted.", &error_abort); + "will be counted."); } bool kvm_arm_pmu_supported(CPUState *cpu) diff --git a/target/i386/sev.c b/target/i386/sev.c index 846018a12d..6842cfc26d 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -251,19 +251,19 @@ qsev_guest_class_init(ObjectClass *oc, void *data) qsev_guest_set_sev_device, NULL); object_class_property_set_description(oc, "sev-device", - "SEV device to use", NULL); + "SEV device to use"); object_class_property_add_str(oc, "dh-cert-file", qsev_guest_get_dh_cert_file, qsev_guest_set_dh_cert_file, NULL); object_class_property_set_description(oc, "dh-cert-file", - "guest owners DH certificate (encoded with base64)", NULL); + "guest owners DH certificate (encoded with base64)"); object_class_property_add_str(oc, "session-file", qsev_guest_get_session_file, qsev_guest_set_session_file, NULL); object_class_property_set_description(oc, "session-file", - "guest owners session parameters (encoded with base64)", NULL); + "guest owners session parameters (encoded with base64)"); } static void diff --git a/target/ppc/compat.c b/target/ppc/compat.c index f48df25944..46ffb6da6d 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -324,7 +324,7 @@ void ppc_compat_add_property(Object *obj, const char *name, names = g_strjoinv(", ", namesv); desc = g_strdup_printf("%s. Valid values are %s.", basedesc, names); - object_property_set_description(obj, name, desc, &local_err); + object_property_set_description(obj, name, desc); g_free(names); g_free(desc); diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 7c32180269..aa7fc713ca 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -1107,13 +1107,13 @@ void s390_cpu_model_register_props(Object *obj) const S390FeatDef *def = s390_feat_def(feat); object_property_add(obj, def->name, "bool", get_feature, set_feature, NULL, (void *) feat, NULL); - object_property_set_description(obj, def->name, def->desc , NULL); + object_property_set_description(obj, def->name, def->desc); } for (group = 0; group < S390_FEAT_GROUP_MAX; group++) { const S390FeatGroupDef *def = s390_feat_group_def(group); object_property_add(obj, def->name, "bool", get_feature_group, set_feature_group, NULL, (void *) group, NULL); - object_property_set_description(obj, def->name, def->desc , NULL); + object_property_set_description(obj, def->name, def->desc); } } From patchwork Tue May 5 15:29:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C07ABC47254 for ; Tue, 5 May 2020 15:35:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8B501206B9 for ; Tue, 5 May 2020 15:35:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Vek+7cTW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B501206B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVzb8-0000gl-Gd for qemu-devel@archiver.kernel.org; Tue, 05 May 2020 11:35:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVzVq-0003NT-PT for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:38 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:24631 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVzVl-0007QW-Co for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588692571; h=from:from: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; bh=BfvPDqW/knyQKGlAtdClqdP25r0g9LJ1Uccxe20cSpc=; b=Vek+7cTWY7h7sRQwth658cTnXohDFcE5q5sR5Ts7fpH6Qo9JTBDhgYqhxhTnDCBSraOCSs DPL3PuDT5LokbFmb+tt5HfwvOTiQrlADxgWAhCjjVbLeC62TIdOzLdVIrjPk63+AtddVBm qhc4tzxckTCzznWK9FjPL58/8GJUHCg= 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-494-dIYTK3DgOUWKnH0q8iznQA-1; Tue, 05 May 2020 11:29:30 -0400 X-MC-Unique: dIYTK3DgOUWKnH0q8iznQA-1 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 5FF05107ACF3 for ; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2ACED5D785; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4855211358C4; Tue, 5 May 2020 17:29:26 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 08/18] tests/check-qom-proplist: Improve iterator coverage Date: Tue, 5 May 2020 17:29:16 +0200 Message-Id: <20200505152926.18877-9-armbru@redhat.com> In-Reply-To: <20200505152926.18877-1-armbru@redhat.com> References: <20200505152926.18877-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 03:48:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com, philmd@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The tests' "qemu-dummy" device has only class properties. Turn one of them into an instance property. test_dummy_class_iterator() expects one fewer property than test_dummy_iterator(). Rewrite test_dummy_prop_iterator() to take expected properties as argument. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Paolo Bonzini --- tests/check-qom-proplist.c | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index a8b2958e6e..140d56439a 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -130,17 +130,18 @@ static void dummy_init(Object *obj) object_property_add_bool(obj, "bv", dummy_get_bv, dummy_set_bv, - &err); + NULL); + /* duplicate: */ + object_property_add_str(obj, "sv", + dummy_get_sv, + dummy_set_sv, + &err); error_free_or_abort(&err); } static void dummy_class_init(ObjectClass *cls, void *data) { - object_class_property_add_bool(cls, "bv", - dummy_get_bv, - dummy_set_bv, - NULL); object_class_property_add_str(cls, "sv", dummy_get_sv, dummy_set_sv, @@ -520,34 +521,33 @@ static void test_dummy_getenum(void) } -static void test_dummy_prop_iterator(ObjectPropertyIterator *iter) +static void test_dummy_prop_iterator(ObjectPropertyIterator *iter, + const char *expected[], int n) { - bool seenbv = false, seensv = false, seenav = false, seentype = false; ObjectProperty *prop; + int i; while ((prop = object_property_iter_next(iter))) { - if (!seenbv && g_str_equal(prop->name, "bv")) { - seenbv = true; - } else if (!seensv && g_str_equal(prop->name, "sv")) { - seensv = true; - } else if (!seenav && g_str_equal(prop->name, "av")) { - seenav = true; - } else if (!seentype && g_str_equal(prop->name, "type")) { - /* This prop comes from the base Object class */ - seentype = true; - } else { - g_printerr("Found prop '%s'\n", prop->name); - g_assert_not_reached(); + for (i = 0; i < n; i++) { + if (!g_strcmp0(prop->name, expected[i])) { + break; + } } + g_assert(i < n); + expected[i] = NULL; + } + + for (i = 0; i < n; i++) { + g_assert(!expected[i]); } - g_assert(seenbv); - g_assert(seenav); - g_assert(seensv); - g_assert(seentype); } static void test_dummy_iterator(void) { + const char *expected[] = { + "type", /* inherited from TYPE_OBJECT */ + "sv", "av", /* class properties */ + "bv"}; /* instance property */ Object *parent = object_get_objects_root(); DummyObject *dobj = DUMMY_OBJECT( object_new_with_props(TYPE_DUMMY, @@ -561,17 +561,18 @@ static void test_dummy_iterator(void) ObjectPropertyIterator iter; object_property_iter_init(&iter, OBJECT(dobj)); - test_dummy_prop_iterator(&iter); + test_dummy_prop_iterator(&iter, expected, ARRAY_SIZE(expected)); object_unparent(OBJECT(dobj)); } static void test_dummy_class_iterator(void) { + const char *expected[] = { "type", "av", "sv" }; ObjectPropertyIterator iter; ObjectClass *klass = object_class_by_name(TYPE_DUMMY); object_class_property_iter_init(&iter, klass); - test_dummy_prop_iterator(&iter); + test_dummy_prop_iterator(&iter, expected, ARRAY_SIZE(expected)); } static void test_dummy_delchild(void) From patchwork Tue May 5 15:29:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 283EEC47254 for ; Tue, 5 May 2020 15:31:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E113C2078C for ; Tue, 5 May 2020 15:31:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RXGYMbFk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E113C2078C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVzXc-0005Cd-0c for qemu-devel@archiver.kernel.org; Tue, 05 May 2020 11:31:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVzVo-0003Jz-1B for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:36 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:53135 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVzVl-0007Qb-GL for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588692572; h=from:from: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; bh=qJSrLVvjDTVg1XFdetvzYSjvKRLzEDahkF7hmIqY9c4=; b=RXGYMbFkA+28oIY9t0nNlHnpsme0zp0TzXsyPInWcRayBKge6uiDNNqMh59MOrpKqXl35D 1Kt4XTLBZuZTvwUCE6T0w4ooFnp5HiaOgbD4uLUkLTcGrN7nJWKn+Nv8vkJ7Zs4Rgxnfg7 jjJB3B3ALAbq7Cv29wz9mjPrPz/b9mg= 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-301-l0ODgHXROYWxO3W9vxyzOQ-1; Tue, 05 May 2020 11:29:30 -0400 X-MC-Unique: l0ODgHXROYWxO3W9vxyzOQ-1 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 7C91018FE864 for ; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 488C05D9D5; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 522AA11358C7; Tue, 5 May 2020 17:29:26 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 11/18] e1000: Don't run e1000_instance_init() twice Date: Tue, 5 May 2020 17:29:19 +0200 Message-Id: <20200505152926.18877-12-armbru@redhat.com> In-Reply-To: <20200505152926.18877-1-armbru@redhat.com> References: <20200505152926.18877-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 00:37:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: berrange@redhat.com, ehabkost@redhat.com, philmd@redhat.com, Jason Wang , pbonzini@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" QOM object initialization runs .instance_init() for the type and all its supertypes; see object_init_with_type(). Both TYPE_E1000_BASE and its concrete subtypes set .instance_init() to e1000_instance_init(). For the concrete subtypes, it duly gets run twice. The second run fails, but the error gets ignored (a later commit will change that). Remove it from the subtypes. Cc: Jason Wang Signed-off-by: Markus Armbruster Acked-by: Jason Wang Reviewed-by: Paolo Bonzini --- hw/net/e1000.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 2a69eee63f..0d2c2759e3 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1824,7 +1824,6 @@ static void e1000_register_types(void) type_info.parent = TYPE_E1000_BASE; type_info.class_data = (void *)info; type_info.class_init = e1000_class_init; - type_info.instance_init = e1000_instance_init; type_register(&type_info); } From patchwork Tue May 5 15:29:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34B68C47247 for ; Tue, 5 May 2020 15:45:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F41A42073B for ; Tue, 5 May 2020 15:45:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T2QIO6Og" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F41A42073B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVzlK-0006B4-5H for qemu-devel@archiver.kernel.org; Tue, 05 May 2020 11:45:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVzVu-0003Tp-NR for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:42 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:60165 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVzVp-0007VY-8s for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588692576; h=from:from: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; bh=sZXFtlUJilR+Fg2pc8i1e5FuQYdjyR/PnHfZpdXP6U8=; b=T2QIO6OgXWJSFEQ97GvKHdPqXDtEhBSco+V83j5oUK0L+j01Caym1VX6zJTPx99y6rRGeU M/ceLcq9hF+xe6q5FmxKNhG59wF/MN7pjLht3LIkdDtU9FZGh7jJ8QA+a1/VtEHa8LEqQD NSmjMP1SDKmZdIHhsJRulO39PDMg1nA= 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-23-BGqJFzFWOOOTBOJmzw8KZA-1; Tue, 05 May 2020 11:29:30 -0400 X-MC-Unique: BGqJFzFWOOOTBOJmzw8KZA-1 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 8983F800687; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5158562482; Tue, 5 May 2020 15:29:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5576611358C8; Tue, 5 May 2020 17:29:26 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 12/18] hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory Date: Tue, 5 May 2020 17:29:20 +0200 Message-Id: <20200505152926.18877-13-armbru@redhat.com> In-Reply-To: <20200505152926.18877-1-armbru@redhat.com> References: <20200505152926.18877-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 00:37:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , berrange@redhat.com, ehabkost@redhat.com, philmd@redhat.com, =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The "bcm2835-peripherals" device's .instance_init() method bcm2835_peripherals_init() attempts to make two memory regions QOM children of the device. This is futile, because memory_region_init() already did. The errors are ignored (a later commit will change that). Drop the useless calls. Cc: Peter Maydell Cc: Andrew Baumann Cc: "Philippe Mathieu-Daudé" Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eric Blake --- hw/arm/bcm2835_peripherals.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index edcaa4916d..8b399d67ff 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -43,12 +43,10 @@ static void bcm2835_peripherals_init(Object *obj) /* Memory region for peripheral devices, which we export to our parent */ memory_region_init(&s->peri_mr, obj,"bcm2835-peripherals", 0x1000000); - object_property_add_child(obj, "peripheral-io", OBJECT(&s->peri_mr), NULL); sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->peri_mr); /* Internal memory region for peripheral bus addresses (not exported) */ memory_region_init(&s->gpu_bus_mr, obj, "bcm2835-gpu", (uint64_t)1 << 32); - object_property_add_child(obj, "gpu-bus", OBJECT(&s->gpu_bus_mr), NULL); /* Internal memory region for request/response communication with * mailbox-addressable peripherals (not exported) From patchwork Tue May 5 15:29:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 283363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B5A6C47247 for ; Tue, 5 May 2020 15:38:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66A02206B9 for ; Tue, 5 May 2020 15:38:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XEw8Ri4B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66A02206B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVzeO-0004Iu-As for qemu-devel@archiver.kernel.org; Tue, 05 May 2020 11:38:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVzVr-0003OU-73 for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:39 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:41519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVzVn-0007RR-A5 for qemu-devel@nongnu.org; Tue, 05 May 2020 11:29:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588692573; h=from:from: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; bh=kBtM3zIW9dthrt5vgz9AzzxJghrxgkviKsCOyjI5V38=; b=XEw8Ri4BSWu/O1xXenFITYaexg0YCJ15dNr9ycG34RvmAIAF/SnOgXMLFk0aO3Bcq7GfWo dRwz5HyiZHEUHGRoF6v1NkvIn/PlRYjsERnZw3Cb49pvrkSK7ID5c/rD1KMwElLpbjKNIn mJb6PTAM5dQMsqQjsL0crdkMcFaI51o= 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-16-xP_tXZ4EPKiGpGrF9mtcVg-1; Tue, 05 May 2020 11:29:32 -0400 X-MC-Unique: xP_tXZ4EPKiGpGrF9mtcVg-1 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 2ED33800D24 for ; Tue, 5 May 2020 15:29:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-6.ams2.redhat.com [10.36.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C906E6061C; Tue, 5 May 2020 15:29:30 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6DAC111358CF; Tue, 5 May 2020 17:29:26 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 18/18] qom: Drop @errp parameter of object_property_del() Date: Tue, 5 May 2020 17:29:26 +0200 Message-Id: <20200505152926.18877-19-armbru@redhat.com> In-Reply-To: <20200505152926.18877-1-armbru@redhat.com> References: <20200505152926.18877-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 00:37:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com, philmd@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Same story as for object_property_add(): the only way object_property_del() can fail is when the property with this name does not exist. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing &error_abort. Most callers do that, the commit before previous fixed one that didn't (and got the error handling wrong), and the two remaining exceptions ignore errors. Drop the @errp parameter. Signed-off-by: Markus Armbruster Reviewed-by: Paolo Bonzini --- include/qom/object.h | 2 +- hw/core/qdev.c | 2 +- hw/i386/pc_sysfw.c | 2 +- hw/ppc/spapr_drc.c | 4 ++-- qom/object.c | 7 +------ qom/object_interfaces.c | 3 +-- tests/check-qom-proplist.c | 2 +- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 990e28e408..fd453dc8d6 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1047,7 +1047,7 @@ ObjectProperty *object_property_add(Object *obj, const char *name, ObjectPropertyRelease *release, void *opaque); -void object_property_del(Object *obj, const char *name, Error **errp); +void object_property_del(Object *obj, const char *name); ObjectProperty *object_class_property_add(ObjectClass *klass, const char *name, const char *type, diff --git a/hw/core/qdev.c b/hw/core/qdev.c index b9c7a2f904..9e5538aeae 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -65,7 +65,7 @@ static void bus_remove_child(BusState *bus, DeviceState *child) bus->num_children--; /* This gives back ownership of kid->child back to us. */ - object_property_del(OBJECT(bus), name, NULL); + object_property_del(OBJECT(bus), name); object_unref(OBJECT(kid->child)); g_free(kid); return; diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 002133a2d8..2abab3a27c 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -120,7 +120,7 @@ static void pc_system_flash_cleanup_unused(PCMachineState *pcms) dev_obj = OBJECT(pcms->flash[i]); if (!object_property_get_bool(dev_obj, "realized", &error_abort)) { prop_name = g_strdup_printf("pflash%d", i); - object_property_del(OBJECT(pcms), prop_name, &error_abort); + object_property_del(OBJECT(pcms), prop_name); g_free(prop_name); object_unparent(dev_obj); pcms->flash[i] = NULL; diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 8b2171f698..b958f8acb5 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -405,7 +405,7 @@ static void spapr_drc_release(SpaprDrc *drc) g_free(drc->fdt); drc->fdt = NULL; drc->fdt_start_offset = 0; - object_property_del(OBJECT(drc), "device", &error_abort); + object_property_del(OBJECT(drc), "device"); drc->dev = NULL; } @@ -551,7 +551,7 @@ static void unrealize(DeviceState *d) vmstate_unregister(VMSTATE_IF(drc), &vmstate_spapr_drc, drc); root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); name = g_strdup_printf("%x", spapr_drc_index(drc)); - object_property_del(root_container, name, &error_abort); + object_property_del(root_container, name); g_free(name); } diff --git a/qom/object.c b/qom/object.c index 23f481ca46..e89ffbe3d1 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1280,15 +1280,10 @@ ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name, return prop; } -void object_property_del(Object *obj, const char *name, Error **errp) +void object_property_del(Object *obj, const char *name) { ObjectProperty *prop = g_hash_table_lookup(obj->properties, name); - if (!prop) { - error_setg(errp, "Property '.%s' not found", name); - return; - } - if (prop->release) { prop->release(obj, name, prop->opaque); } diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 054e75043d..7e26f86fa6 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -89,8 +89,7 @@ Object *user_creatable_add_type(const char *type, const char *id, user_creatable_complete(USER_CREATABLE(obj), &local_err); if (local_err) { if (id != NULL) { - object_property_del(object_get_objects_root(), - id, &error_abort); + object_property_del(object_get_objects_root(), id); } goto out; } diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index 84f48fe592..13a824cfae 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -280,7 +280,7 @@ static void dummy_bus_init(Object *obj) static void dummy_bus_unparent(Object *obj) { DummyBus *bus = DUMMY_BUS(obj); - object_property_del(obj->parent, "backend", NULL); + object_property_del(obj->parent, "backend"); object_unparent(OBJECT(bus->backend)); }