[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v2 3/6] hw/arm: Use sysbus_init_child_obj for correct
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-arm] [PATCH v2 3/6] hw/arm: Use sysbus_init_child_obj for correct reference counting |
Date: |
Fri, 23 Aug 2019 16:32:46 +0200 |
As explained in commit aff39be0ed97:
Both functions, object_initialize() and qdev_set_parent_bus()
increase the reference counter of the new object, so one of the
references has to be dropped afterwards to get the reference
counting right. Otherwise the child object will not be properly
cleaned up when the parent gets destroyed.
Thus let's use now sysbus_init_child_obj() instead to get the
reference counting here right.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
v2: Corrected commit description (pm215)
---
hw/arm/exynos4_boards.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
index f69358a5ba..2781d8bd41 100644
--- a/hw/arm/exynos4_boards.c
+++ b/hw/arm/exynos4_boards.c
@@ -131,8 +131,8 @@ exynos4_boards_init_common(MachineState *machine,
exynos4_boards_init_ram(s, get_system_memory(),
exynos4_board_ram_size[board_type]);
- object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC);
- qdev_set_parent_bus(DEVICE(&s->soc), sysbus_get_default());
+ sysbus_init_child_obj(OBJECT(machine), "soc",
+ &s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC);
object_property_set_bool(OBJECT(&s->soc), true, "realized",
&error_fatal);
--
2.20.1
- [Qemu-arm] [PATCH v2 0/6] hw/arm: Use ARM_CPU_TYPE_NAME() and object_initialize_child(), Philippe Mathieu-Daudé, 2019/08/23
- [Qemu-arm] [PATCH v2 1/6] hw/arm: Use ARM_CPU_TYPE_NAME() macro when appropriate, Philippe Mathieu-Daudé, 2019/08/23
- [Qemu-arm] [PATCH v2 2/6] hw/arm: Use object_initialize_child for correct reference counting, Philippe Mathieu-Daudé, 2019/08/23
- [Qemu-arm] [PATCH v2 3/6] hw/arm: Use sysbus_init_child_obj for correct reference counting,
Philippe Mathieu-Daudé <=
- [Qemu-arm] [PATCH v2 4/6] hw/arm/fsl-imx: Add the cpu as child of the SoC object, Philippe Mathieu-Daudé, 2019/08/23
- [Qemu-arm] [PATCH v2 5/6] hw/dma/xilinx_axi: Use object_initialize_child for correct ref. counting, Philippe Mathieu-Daudé, 2019/08/23
- [Qemu-arm] [PATCH v2 6/6] hw/net/xilinx_axi: Use object_initialize_child for correct ref. counting, Philippe Mathieu-Daudé, 2019/08/23