qom: Tidy up a few object_initialize_child() calls
authorMarkus Armbruster <armbru@redhat.com>
Wed, 10 Jun 2020 05:32:24 +0000 (07:32 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 15 Jun 2020 20:05:28 +0000 (22:05 +0200)
The callers of object_initialize_child() commonly  pass either
&child, sizeof(child), or pchild, sizeof(*pchild).  Tidy up the few
that don't, mostly to keep the next commit simpler.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-36-armbru@redhat.com>

hw/arm/aspeed.c
hw/microblaze/xlnx-zynqmp-pmu.c
hw/pci-host/pnv_phb4.c
hw/riscv/riscv_hart.c

index 2b96244cf51066b1d7d5c335d19768d9237bc932..ee50476ccbd1573e48f2d9fad534c298181d7e81 100644 (file)
@@ -268,7 +268,7 @@ static void aspeed_machine_init(MachineState *machine)
     memory_region_add_subregion(&bmc->ram_container, 0, machine->ram);
 
     object_initialize_child(OBJECT(machine), "soc", &bmc->soc,
-                            (sizeof(bmc->soc)), amc->soc_name, &error_abort,
+                            sizeof(bmc->soc), amc->soc_name, &error_abort,
                             NULL);
 
     sc = ASPEED_SOC_GET_CLASS(&bmc->soc);
index 028f31894d9d9669f08ad74dc0d554dfd429df90..aa90b9d1beb58588d4b44e222ad80a9610f3d7ee 100644 (file)
@@ -174,8 +174,7 @@ static void xlnx_zynqmp_pmu_init(MachineState *machine)
                                 pmu_ram);
 
     /* Create the PMU device */
-    object_initialize_child(OBJECT(machine), "pmu", pmu,
-                            sizeof(XlnxZynqMPPMUSoCState),
+    object_initialize_child(OBJECT(machine), "pmu", pmu, sizeof(*pmu),
                             TYPE_XLNX_ZYNQMP_PMU_SOC, &error_abort, NULL);
     object_property_set_bool(OBJECT(pmu), true, "realized", &error_fatal);
 
index e30ae9ad5b5099f30dbdc1561cb658cd1c87f220..aba710fd1f7cdb2d01a4544b0ba154fcc01146af 100644 (file)
@@ -1155,7 +1155,7 @@ static void pnv_phb4_instance_init(Object *obj)
     QLIST_INIT(&phb->dma_spaces);
 
     /* XIVE interrupt source object */
-    object_initialize_child(obj, "source", &phb->xsrc, sizeof(XiveSource),
+    object_initialize_child(obj, "source", &phb->xsrc, sizeof(phb->xsrc),
                             TYPE_XIVE_SOURCE, &error_abort, NULL);
 
     /* Root Port */
index 276a9baca084cb72c779a84311aa29b0910bc260..61e88e2e372ff7cfeb8e43922b7ff07f1e4ec2e6 100644 (file)
@@ -46,7 +46,7 @@ static void riscv_hart_realize(RISCVHartArrayState *s, int idx,
     Error *err = NULL;
 
     object_initialize_child(OBJECT(s), "harts[*]", &s->harts[idx],
-                            sizeof(RISCVCPU), cpu_type,
+                            sizeof(s->harts[idx]), cpu_type,
                             &error_abort, NULL);
     s->harts[idx].env.mhartid = s->hartid_base + idx;
     qemu_register_reset(riscv_harts_cpu_reset, &s->harts[idx]);