hw/arm/fsl-imx7: Fix introspection problems with the "fsl, imx7" device
commitf8bf4b6d38e966bf7b2fd77a2ef227e0805b6d0d
authorThomas Huth <thuth@redhat.com>
Mon, 16 Jul 2018 12:59:26 +0000 (16 14:59 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 17 Jul 2018 12:12:49 +0000 (17 13:12 +0100)
tree307f59a502ef4c530c2978e3f74365ba76bc6b63
parente9e4d4d3e180a35d244371fd724a9a67404678cf
hw/arm/fsl-imx7: Fix introspection problems with the "fsl, imx7" device

Running QEMU with valgrind indicates a problem here:

echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
 "'arguments':{'typename':'fsl,imx7'}}" \
 "{'execute': 'human-monitor-command', " \
 "'arguments': {'command-line': 'info qtree'}}" | \
 valgrind -q aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp stdio
[...]
==27284== Invalid read of size 8
==27284==    at 0x618F7A: qdev_print (qdev-monitor.c:686)
==27284==    by 0x618F7A: qbus_print (qdev-monitor.c:719)
==27284==    by 0x452B38: handle_hmp_command (monitor.c:3446)
[...]

Use the new sysbus_init_child_obj() and object_initialize_child() to make
sure that the objects are removed correctly when the parent gets destroyed.

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-10-git-send-email-thuth@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/fsl-imx7.c