diff mbox series

[18/21] hw/pci-host/versatile: Replace object_initialize() -> _child()

Message ID 20240216110313.17039-19-philmd@linaro.org
State New
Headers show
Series hw: More QDev cleanups | expand

Commit Message

Philippe Mathieu-Daudé Feb. 16, 2024, 11:03 a.m. UTC
When the QOM parent is available, prefer object_initialize_child()
over object_initialize(), since it create the parent relationship.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/pci-host/versatile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index 0e65deb3f9..5d1f9cc96d 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(dev), "pci-func0",
+                            &s->pci_dev, TYPE_VERSATILE_PCI_HOST);
 
     for (i = 0; i < 4; i++) {
         sysbus_init_irq(sbd, &s->irq[i]);