From: Bernhard Beschow <[email protected]> Using sysbus_realize_and_unref() requires object_new() rather than object_new_with_props(), otherwise the initial reference count is subtracted twice, i.e. ends up being one too low.
Cc: [email protected] Fixes: 7bcd1f30bc83 ("hw/arm: Add the i.MX 8MM EVK board") Reported-by: Peter Maydell <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Reviewed-by: Bin Meng <[email protected]> Signed-off-by: Bernhard Beschow <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> (cherry picked from commit c814f8c9f8e788051ef16dba6300af93f9c0190d) Signed-off-by: Michael Tokarev <[email protected]> diff --git a/hw/arm/imx8mm-evk.c b/hw/arm/imx8mm-evk.c index 6b7774d3e25..9a9f8921da6 100644 --- a/hw/arm/imx8mm-evk.c +++ b/hw/arm/imx8mm-evk.c @@ -77,8 +77,8 @@ static void imx8mm_evk_init(MachineState *machine) .modify_dtb = imx8mm_evk_modify_dtb, }; - s = FSL_IMX8MM(object_new_with_props(TYPE_FSL_IMX8MM, OBJECT(machine), - "soc", &error_fatal, NULL)); + s = FSL_IMX8MM(object_new(TYPE_FSL_IMX8MM)); + object_property_add_child(OBJECT(machine), "soc", OBJECT(s)); object_property_set_uint(OBJECT(s), "fec1-phy-num", 1, &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal); -- 2.47.3
