diff options
author | Thomas Huth <thuth@redhat.com> | 2018-07-16 14:59:29 +0200 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-07-17 13:12:49 +0100 |
commit | b2bc349822fa27c7da4e04535c5dda2cb035965b (patch) | |
tree | 4aafa32084be6d54ddcdfbbb81d099c4509191f1 /hw/cpu | |
parent | aac409c9b09fe5df11e82fc285d4e721d857f486 (diff) |
hw/cpu/arm11mpcore: Fix introspection problem with 'arm11mpcore_priv'
Valgrind reports an error here:
echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
"'arguments':{'typename':'arm11mpcore_priv'}}" \
"{'execute': 'human-monitor-command', " \
"'arguments': {'command-line': 'info qtree'}}" | \
valgrind -q aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp stdio
[...]
==3145== Invalid read of size 8
==3145== at 0x61873A: qdev_print (qdev-monitor.c:686)
==3145== by 0x61873A: qbus_print (qdev-monitor.c:719)
[...]
Use sysbus_init_child_obj() to fix it.
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>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 1531745974-17187-13-git-send-email-thuth@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/cpu')
-rw-r--r-- | hw/cpu/arm11mpcore.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c index eb244658b9..8aead3794e 100644 --- a/hw/cpu/arm11mpcore.c +++ b/hw/cpu/arm11mpcore.c @@ -121,19 +121,17 @@ static void mpcore_priv_initfn(Object *obj) "mpcore-priv-container", 0x2000); sysbus_init_mmio(sbd, &s->container); - object_initialize(&s->scu, sizeof(s->scu), TYPE_ARM11_SCU); - qdev_set_parent_bus(DEVICE(&s->scu), sysbus_get_default()); + sysbus_init_child_obj(obj, "scu", &s->scu, sizeof(s->scu), TYPE_ARM11_SCU); - object_initialize(&s->gic, sizeof(s->gic), TYPE_ARM_GIC); - qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default()); + sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic), TYPE_ARM_GIC); /* Request the legacy 11MPCore GIC behaviour: */ qdev_prop_set_uint32(DEVICE(&s->gic), "revision", 0); - object_initialize(&s->mptimer, sizeof(s->mptimer), TYPE_ARM_MPTIMER); - qdev_set_parent_bus(DEVICE(&s->mptimer), sysbus_get_default()); + sysbus_init_child_obj(obj, "mptimer", &s->mptimer, sizeof(s->mptimer), + TYPE_ARM_MPTIMER); - object_initialize(&s->wdtimer, sizeof(s->wdtimer), TYPE_ARM_MPTIMER); - qdev_set_parent_bus(DEVICE(&s->wdtimer), sysbus_get_default()); + sysbus_init_child_obj(obj, "wdtimer", &s->wdtimer, sizeof(s->wdtimer), + TYPE_ARM_MPTIMER); } static Property mpcore_priv_properties[] = { |