aboutsummaryrefslogtreecommitdiff
path: root/hw/display
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-05-05 17:29:22 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-05-15 07:07:58 +0200
commitd2623129a7dec1d3041ad1221dda1ca49c667532 (patch)
tree9bcac33dfaed2361cd536856159b9960135ccd46 /hw/display
parent9f742c28f52d55ff83dc441a0cea365239a4906d (diff)
qom: Drop parameter @errp of object_property_add() & friends
The only way object_property_add() can fail is when a property with the same name already exists. Since our property names are all hardcoded, failure is a programming error, and the appropriate way to handle it is passing &error_abort. Same for its variants, except for object_property_add_child(), which additionally fails when the child already has a parent. Parentage is also under program control, so this is a programming error, too. We have a bit over 500 callers. Almost half of them pass &error_abort, slightly fewer ignore errors, one test case handles errors, and the remaining few callers pass them to their own callers. The previous few commits demonstrated once again that ignoring programming errors is a bad idea. Of the few ones that pass on errors, several violate the Error API. The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. ich9_pm_add_properties(), sparc32_ledma_realize(), sparc32_dma_realize(), xilinx_axidma_realize(), xilinx_enet_realize() are wrong that way. When the one appropriate choice of argument is &error_abort, letting users pick the argument is a bad idea. Drop parameter @errp and assert the preconditions instead. There's one exception to "duplicate property name is a programming error": the way object_property_add() implements the magic (and undocumented) "automatic arrayification". Don't drop @errp there. Instead, rename object_property_add() to object_property_try_add(), and add the obvious wrapper object_property_add(). 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-15-armbru@redhat.com> [Two semantic rebase conflicts resolved]
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/bochs-display.c3
-rw-r--r--hw/display/sm501.c2
-rw-r--r--hw/display/vga-pci.c4
-rw-r--r--hw/display/vhost-user-gpu-pci.c3
-rw-r--r--hw/display/vhost-user-gpu.c2
-rw-r--r--hw/display/vhost-user-vga.c3
-rw-r--r--hw/display/xlnx_dp.c7
7 files changed, 10 insertions, 14 deletions
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index e763a0a72d..a8e8ab8325 100644
--- a/hw/display/bochs-display.c
+++ b/hw/display/bochs-display.c
@@ -333,8 +333,7 @@ static void bochs_display_init(Object *obj)
/* Expose framebuffer byteorder via QOM */
object_property_add_bool(obj, "big-endian-framebuffer",
bochs_display_get_big_endian_fb,
- bochs_display_set_big_endian_fb,
- NULL);
+ bochs_display_set_big_endian_fb);
dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
}
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index de0ab9d977..296cd56c4a 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -2011,7 +2011,7 @@ static void sm501_sysbus_init(Object *o)
qdev_prop_set_uint8(DEVICE(smm), "endianness", DEVICE_LITTLE_ENDIAN);
object_property_add_alias(o, "chardev",
- OBJECT(smm), "chardev", &error_abort);
+ OBJECT(smm), "chardev");
}
static const TypeInfo sm501_sysbus_info = {
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index 6b9db86e36..a640fd866d 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -270,7 +270,7 @@ static void pci_std_vga_init(Object *obj)
{
/* Expose framebuffer byteorder via QOM */
object_property_add_bool(obj, "big-endian-framebuffer",
- vga_get_big_endian_fb, vga_set_big_endian_fb, NULL);
+ vga_get_big_endian_fb, vga_set_big_endian_fb);
}
static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp)
@@ -321,7 +321,7 @@ static void pci_secondary_vga_init(Object *obj)
{
/* Expose framebuffer byteorder via QOM */
object_property_add_bool(obj, "big-endian-framebuffer",
- vga_get_big_endian_fb, vga_set_big_endian_fb, NULL);
+ vga_get_big_endian_fb, vga_set_big_endian_fb);
}
static void pci_secondary_vga_reset(DeviceState *dev)
diff --git a/hw/display/vhost-user-gpu-pci.c b/hw/display/vhost-user-gpu-pci.c
index 7d9b1f5a8c..23ce655e0f 100644
--- a/hw/display/vhost-user-gpu-pci.c
+++ b/hw/display/vhost-user-gpu-pci.c
@@ -32,8 +32,7 @@ static void vhost_user_gpu_pci_initfn(Object *obj)
VIRTIO_GPU_PCI_BASE(obj)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
object_property_add_alias(obj, "chardev",
- OBJECT(&dev->vdev), "chardev",
- &error_abort);
+ OBJECT(&dev->vdev), "chardev");
}
static const VirtioPCIDeviceTypeInfo vhost_user_gpu_pci_info = {
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index f0c7c6fb9a..4cdaee1bde 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -512,7 +512,7 @@ vhost_user_gpu_instance_init(Object *obj)
g->vhost = VHOST_USER_BACKEND(object_new(TYPE_VHOST_USER_BACKEND));
object_property_add_alias(obj, "chardev",
- OBJECT(g->vhost), "chardev", &error_abort);
+ OBJECT(g->vhost), "chardev");
}
static void
diff --git a/hw/display/vhost-user-vga.c b/hw/display/vhost-user-vga.c
index a7195276d9..1690f6b610 100644
--- a/hw/display/vhost-user-vga.c
+++ b/hw/display/vhost-user-vga.c
@@ -33,8 +33,7 @@ static void vhost_user_vga_inst_initfn(Object *obj)
VIRTIO_VGA_BASE(dev)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
object_property_add_alias(obj, "chardev",
- OBJECT(&dev->vdev), "chardev",
- &error_abort);
+ OBJECT(&dev->vdev), "chardev");
}
static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = {
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index 7058443797..3e5fb44e06 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -1237,8 +1237,7 @@ static void xlnx_dp_init(Object *obj)
object_property_add_link(obj, "dpdma", TYPE_XLNX_DPDMA,
(Object **) &s->dpdma,
xlnx_dp_set_dpdma,
- OBJ_PROP_LINK_STRONG,
- &error_abort);
+ OBJ_PROP_LINK_STRONG);
/*
* Initialize AUX Bus.
@@ -1249,11 +1248,11 @@ static void xlnx_dp_init(Object *obj)
* Initialize DPCD and EDID..
*/
s->dpcd = DPCD(aux_create_slave(s->aux_bus, "dpcd"));
- object_property_add_child(OBJECT(s), "dpcd", OBJECT(s->dpcd), NULL);
+ object_property_add_child(OBJECT(s), "dpcd", OBJECT(s->dpcd));
s->edid = I2CDDC(qdev_create(BUS(aux_get_i2c_bus(s->aux_bus)), "i2c-ddc"));
i2c_set_slave_address(I2C_SLAVE(s->edid), 0x50);
- object_property_add_child(OBJECT(s), "edid", OBJECT(s->edid), NULL);
+ object_property_add_child(OBJECT(s), "edid", OBJECT(s->edid));
fifo8_create(&s->rx_fifo, 16);
fifo8_create(&s->tx_fifo, 16);