From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, "Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PULL 18/21] qom: Drop @errp parameter of object_property_del()
Date: Fri, 15 May 2020 08:04:21 +0200 [thread overview]
Message-ID: <20200515060424.18993-19-armbru@redhat.com> (raw)
In-Reply-To: <20200515060424.18993-1-armbru@redhat.com>
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 <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200505152926.18877-19-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
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));
}
--
2.21.1
next prev parent reply other threads:[~2020-05-15 6:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 6:04 [PULL 00/21] QOM patches for 2020-05-15 Markus Armbruster
2020-05-15 6:04 ` [PULL 01/21] qom: Clearer reference counting in object_initialize_childv() Markus Armbruster
2020-05-15 6:04 ` [PULL 02/21] qom: Clean up inconsistent use of gchar * vs. char * Markus Armbruster
2020-05-15 6:04 ` [PULL 03/21] qom: Drop object_property_del_child()'s unused parameter @errp Markus Armbruster
2020-05-15 6:04 ` [PULL 04/21] qom: Simplify object_property_get_enum() Markus Armbruster
2020-05-15 6:04 ` [PULL 05/21] qom: Drop convenience method object_property_get_uint16List() Markus Armbruster
2020-05-15 6:04 ` [PULL 06/21] qom: Make all the object_property_add_FOO() return the property Markus Armbruster
2020-05-15 6:04 ` [PULL 07/21] qom: Drop object_property_set_description() parameter @errp Markus Armbruster
2020-05-15 6:04 ` [PULL 08/21] tests/check-qom-proplist: Improve iterator coverage Markus Armbruster
2020-05-15 6:04 ` [PULL 09/21] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Markus Armbruster
2020-05-15 6:04 ` [PULL 10/21] hw/isa/superio: Make the components QOM children Markus Armbruster
2020-05-15 6:04 ` [PULL 11/21] e1000: Don't run e1000_instance_init() twice Markus Armbruster
2020-05-15 6:04 ` [PULL 12/21] hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory Markus Armbruster
2020-05-15 6:04 ` [PULL 13/21] qdev: Clean up qdev_connect_gpio_out_named() Markus Armbruster
2020-05-15 6:04 ` [PULL 14/21] qom: Drop parameter @errp of object_property_add() & friends Markus Armbruster
2020-05-15 6:04 ` [PULL 15/21] Drop more @errp parameters after previous commit Markus Armbruster
2020-05-15 6:04 ` [PULL 16/21] qdev: Unrealize must not fail Markus Armbruster
2020-05-15 6:04 ` [PULL 17/21] spapr_pci: Drop some dead error handling Markus Armbruster
2020-05-15 6:04 ` Markus Armbruster [this message]
2020-05-15 6:04 ` [PULL 19/21] target: Remove unnecessary CPU() cast Markus Armbruster
2020-05-15 6:04 ` [PULL 20/21] various: Remove unnecessary OBJECT() cast Markus Armbruster
2020-05-15 6:04 ` [PULL 21/21] hw: Remove unnecessary DEVICE() cast Markus Armbruster
2020-05-15 7:17 ` [PULL 00/21] QOM patches for 2020-05-15 no-reply
2020-05-15 8:54 ` no-reply
2020-05-15 10:17 ` Peter Maydell
2020-05-15 14:34 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200515060424.18993-19-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).