The embedded versatile_pci_host device was initialized via
object_initialize() without ever being parented, so it landed in
/machine/unattached at realize time.  Switch to
object_initialize_child() so it becomes a proper child<> of the
host bridge.

Assisted-by: Kiro
Signed-off-by: Alexander Graf <[email protected]>
---
 hw/pci-host/versatile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index b27531f7fb..b749bcf1a1 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -410,7 +410,8 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp)
                       PCI_DEVFN(11, 0), TYPE_PCI_BUS);
     h->bus = &s->pci_bus;
 
-    object_initialize(&s->pci_dev, sizeof(s->pci_dev), 
TYPE_VERSATILE_PCI_HOST);
+    object_initialize_child(OBJECT(s), "pci-host", &s->pci_dev,
+                            TYPE_VERSATILE_PCI_HOST);
 
     for (i = 0; i < 4; i++) {
         sysbus_init_irq(sbd, &s->irq[i]);
-- 
2.47.1


Reply via email to