From 7eecec7d1224890b0d04479dd4736e1eefaa72dc Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 5 May 2020 17:29:15 +0200 Subject: qom: Drop object_property_set_description() parameter @errp 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 Message-Id: <20200505152926.18877-8-armbru@redhat.com> [One semantic rebase conflict resolved] --- accel/kvm/kvm-all.c | 4 ++-- accel/tcg/tcg-all.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'accel') diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 36be117..9b712aa 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -3113,13 +3113,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 acfdcfd..3398a56 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"); } -- cgit v1.1