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/i386 | |
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/i386')
-rw-r--r-- | hw/i386/microvm.c | 14 | ||||
-rw-r--r-- | hw/i386/pc.c | 2 | ||||
-rw-r--r-- | hw/i386/x86.c | 6 |
3 files changed, 10 insertions, 12 deletions
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 97e345faea..21d4a8ec3a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1971,7 +1971,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 = { |