[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 08/16] hw/arm/msf2-soc: Fix introspection problem
From: |
Thomas Huth |
Subject: |
[Qemu-devel] [PATCH v2 08/16] hw/arm/msf2-soc: Fix introspection problem with the "msf2-soc" device |
Date: |
Fri, 13 Jul 2018 10:27:36 +0200 |
Valgrind currently reports a problem when running QEMU like this:
echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
"'arguments':{'typename':'msf2-soc'}}" \
"{'execute': 'human-monitor-command', " \
"'arguments': {'command-line': 'info qtree'}}" | \
valgrind -q aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp stdio
[...]
==23097== Invalid read of size 8
==23097== at 0x6192AA: qdev_print (qdev-monitor.c:686)
==23097== by 0x6192AA: qbus_print (qdev-monitor.c:719)
[...]
Use the new sysbus_init_child_obj() function to make sure that the child
objects are cleaned up correctly when the parent gets destroyed.
Signed-off-by: Thomas Huth <address@hidden>
---
hw/arm/msf2-soc.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
index edb3ba8..dbefade 100644
--- a/hw/arm/msf2-soc.c
+++ b/hw/arm/msf2-soc.c
@@ -68,19 +68,18 @@ static void m2sxxx_soc_initfn(Object *obj)
MSF2State *s = MSF2_SOC(obj);
int i;
- object_initialize(&s->armv7m, sizeof(s->armv7m), TYPE_ARMV7M);
- qdev_set_parent_bus(DEVICE(&s->armv7m), sysbus_get_default());
+ sysbus_init_child_obj(obj, "armv7m", &s->armv7m, sizeof(s->armv7m),
+ TYPE_ARMV7M);
- object_initialize(&s->sysreg, sizeof(s->sysreg), TYPE_MSF2_SYSREG);
- qdev_set_parent_bus(DEVICE(&s->sysreg), sysbus_get_default());
+ sysbus_init_child_obj(obj, "sysreg", &s->sysreg, sizeof(s->sysreg),
+ TYPE_MSF2_SYSREG);
- object_initialize(&s->timer, sizeof(s->timer), TYPE_MSS_TIMER);
- qdev_set_parent_bus(DEVICE(&s->timer), sysbus_get_default());
+ sysbus_init_child_obj(obj, "timer", &s->timer, sizeof(s->timer),
+ TYPE_MSS_TIMER);
for (i = 0; i < MSF2_NUM_SPIS; i++) {
- object_initialize(&s->spi[i], sizeof(s->spi[i]),
+ sysbus_init_child_obj(obj, "spi[*]", &s->spi[i], sizeof(s->spi[i]),
TYPE_MSS_SPI);
- qdev_set_parent_bus(DEVICE(&s->spi[i]), sysbus_get_default());
}
}
--
1.8.3.1
- [Qemu-devel] [PATCH v2 04/16] hw/arm/armv7: Fix crash when introspecting the "iotkit" device, (continued)
- [Qemu-devel] [PATCH v2 07/16] hw/arm/xlnx-zynqmp: Fix crash when introspecting the "xlnx, zynqmp" device, Thomas Huth, 2018/07/13
- [Qemu-devel] [PATCH v2 08/16] hw/arm/msf2-soc: Fix introspection problem with the "msf2-soc" device,
Thomas Huth <=
- [Qemu-devel] [PATCH v2 09/16] hw/cpu/a9mpcore: Fix introspection problems with the "a9mpcore_priv" device, Thomas Huth, 2018/07/13
- [Qemu-devel] [PATCH v2 10/16] hw/arm/fsl-imx6: Fix introspection problems with the "fsl, imx6" device, Thomas Huth, 2018/07/13
- [Qemu-devel] [PATCH v2 11/16] hw/arm/fsl-imx7: Fix introspection problems with the "fsl, imx7" device, Thomas Huth, 2018/07/13
- [Qemu-devel] [PATCH v2 13/16] hw/arm/fsl-imx31: Fix introspection problem with the "fsl, imx31" device, Thomas Huth, 2018/07/13
- [Qemu-devel] [PATCH v2 14/16] hw/cpu/arm11mpcore: Fix introspection problem with 'arm11mpcore_priv', Thomas Huth, 2018/07/13
- [Qemu-devel] [PATCH v2 12/16] hw/arm/fsl-imx25: Fix introspection problem with the "fsl, imx25" device, Thomas Huth, 2018/07/13
- [Qemu-devel] [PATCH v2 15/16] hw/*/realview: Fix introspection problem with 'realview_mpcore' & 'realview_gic', Thomas Huth, 2018/07/13
- [Qemu-devel] [PATCH v2 16/16] hw/arm/allwinner-a10: Fix introspection problem with 'allwinner-a10', Thomas Huth, 2018/07/13