hw/arm: Use sysbus_init_child_obj for correct reference counting
commit5e039af81667c95a6bd5629e1c7f4422a8857ea1
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Fri, 23 Aug 2019 14:32:46 +0000 (23 16:32 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 3 Sep 2019 15:20:34 +0000 (3 16:20 +0100)
tree653c46aaa57f0be2d7137571d56c11a6ca53a1b7
parent7840938e259f880340109f83bc48c87a250662bd
hw/arm: Use sysbus_init_child_obj for correct reference counting

Both 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.
In machine model code this refcount leak is not particularly
problematic because (unlike devices) machines will never be
created on demand via QMP, and they are never destroyed.
But in any case let's use the new sysbus_init_child_obj() instead
to get the reference counting here right.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190823143249.8096-4-philmd@redhat.com
[PMM: rewrote commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/exynos4_boards.c