On Mon, 21 Sept 2026 at 22:47, Bernhard Beschow <[email protected]> wrote: > > 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. > > Fixes: 7bcd1f30bc83 ("hw/arm: Add the i.MX 8MM EVK(Evaluation Kit) > board") > cc: qemu-stable > Reported-by: Peter Maydell <[email protected]> > Signed-off-by: Bernhard Beschow <[email protected]> > --- > hw/arm/imx8mm-evk.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/arm/imx8mm-evk.c b/hw/arm/imx8mm-evk.c > index c3215b11cb..6de0d9c4a2 100644 > --- a/hw/arm/imx8mm-evk.c > +++ b/hw/arm/imx8mm-evk.c > @@ -83,8 +83,8 @@ static void imx8mm_evk_init(MachineState *machine) > ims->bootinfo.psci_conduit = QEMU_PSCI_CONDUIT_SMC; > ims->bootinfo.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));
Ah, yes, I vaguely remember this. We noticed this was the wrong way to do it for imx8mp-evk.c, in this thread: https://lore.kernel.org/qemu-devel/CAFEAcA_cYDwOFP_h_pKyUQ0kKmT671iZiNntzMC5O5tF=1cC=a...@mail.gmail.com/ but not before I incorrectly suggested using it in the imx8mm patchset that was just landing in the tree at that time. This patch makes imx8mm do the same thing as imx8mp used to do and eg imx6ul does now, so Reviewed-by: Peter Maydell <[email protected]> I do notice that we also have the approach that you changed imx8mp-evk to in 8099d86d3, where we have the SoC struct directly embedded in the machine state struct and can use object_initialize_child(). But we don't need to adopt that here (especially as I think there's an unresolved design discussion about whether we should prefer to avoid the "embed struct in struct" pattern entirely in future). thanks -- PMM
