hw/arm/allwinner-a10: Fix introspection problem with 'allwinner-a10'
Valgrind complains: echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \ "'arguments':{'typename':'allwinner-a10'}}" \ "{'execute': 'human-monitor-command', " \ "'arguments': {'command-line': 'info qtree'}}" | \ valgrind -q aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp stdio [...] ==32519== Invalid read of size 8 ==32519== at 0x61869A: qdev_print (qdev-monitor.c:686) ==32519== by 0x61869A: qbus_print (qdev-monitor.c:719) ==32519== by 0x452B38: handle_hmp_command (monitor.c:3446) [...] Use object_initialize_child() and sysbus_init_child_obj() to fix the issue. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-id: 1531745974-17187-15-git-send-email-thuth@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
32db1b58ca
commit
cf3fccfa8c
@ -27,20 +27,19 @@ static void aw_a10_init(Object *obj)
|
||||
{
|
||||
AwA10State *s = AW_A10(obj);
|
||||
|
||||
object_initialize(&s->cpu, sizeof(s->cpu), "cortex-a8-" TYPE_ARM_CPU);
|
||||
object_property_add_child(obj, "cpu", OBJECT(&s->cpu), NULL);
|
||||
object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
|
||||
"cortex-a8-" TYPE_ARM_CPU, &error_abort, NULL);
|
||||
|
||||
object_initialize(&s->intc, sizeof(s->intc), TYPE_AW_A10_PIC);
|
||||
qdev_set_parent_bus(DEVICE(&s->intc), sysbus_get_default());
|
||||
sysbus_init_child_obj(obj, "intc", &s->intc, sizeof(s->intc),
|
||||
TYPE_AW_A10_PIC);
|
||||
|
||||
object_initialize(&s->timer, sizeof(s->timer), TYPE_AW_A10_PIT);
|
||||
qdev_set_parent_bus(DEVICE(&s->timer), sysbus_get_default());
|
||||
sysbus_init_child_obj(obj, "timer", &s->timer, sizeof(s->timer),
|
||||
TYPE_AW_A10_PIT);
|
||||
|
||||
object_initialize(&s->emac, sizeof(s->emac), TYPE_AW_EMAC);
|
||||
qdev_set_parent_bus(DEVICE(&s->emac), sysbus_get_default());
|
||||
sysbus_init_child_obj(obj, "emac", &s->emac, sizeof(s->emac), TYPE_AW_EMAC);
|
||||
|
||||
object_initialize(&s->sata, sizeof(s->sata), TYPE_ALLWINNER_AHCI);
|
||||
qdev_set_parent_bus(DEVICE(&s->sata), sysbus_get_default());
|
||||
sysbus_init_child_obj(obj, "sata", &s->sata, sizeof(s->sata),
|
||||
TYPE_ALLWINNER_AHCI);
|
||||
}
|
||||
|
||||
static void aw_a10_realize(DeviceState *dev, Error **errp)
|
||||
|
Loading…
Reference in New Issue
Block a user