diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-05-05 17:29:15 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-05-15 07:06:49 +0200 |
commit | 7eecec7d1224890b0d04479dd4736e1eefaa72dc (patch) | |
tree | 58da9dda7cf32c9297f6d710d6dac2f0bf493448 /hw/ppc/spapr.c | |
parent | 702518877220187a858da1a6ba08d53995dc6e2f (diff) |
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 <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200505152926.18877-8-armbru@redhat.com>
[One semantic rebase conflict resolved]
Diffstat (limited to 'hw/ppc/spapr.c')
-rw-r--r-- | hw/ppc/spapr.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c18eab0a23..aa281e727a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3307,8 +3307,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, @@ -3316,8 +3315,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); @@ -3325,14 +3323,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); @@ -3342,27 +3339,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) |