aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/mps2-tz.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-10 07:32:30 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-15 22:05:28 +0200
commit8352a5b8ccdaeb3fc1b00550399abc375ae62d8b (patch)
treede9f2708db29129900f8c5a0688b7bf04f9106ee /hw/arm/mps2-tz.c
parentb0d09949fe2e0d3ebe806356bf782894f5b8acc5 (diff)
sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 1
The callers of sysbus_init_child_obj() commonly pass either &child, sizeof(child), or pchild, sizeof(*pchild). Tidy up the few that use sizeof(child_type) instead, mostly to keep future commits simpler. Coccinelle script: @@ expression parent, propname, type; type T; T child; @@ - sysbus_init_child_obj(parent, propname, &child, sizeof(T), type) + sysbus_init_child_obj(parent, propname, &child, sizeof(child), type) @@ expression parent, propname, type; type T; T *child; @@ - sysbus_init_child_obj(parent, propname, child, sizeof(T), type) + sysbus_init_child_obj(parent, propname, child, sizeof(*child), type) Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-42-armbru@redhat.com>
Diffstat (limited to 'hw/arm/mps2-tz.c')
-rw-r--r--hw/arm/mps2-tz.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
index 8a050228d0..ad0bc9365a 100644
--- a/hw/arm/mps2-tz.c
+++ b/hw/arm/mps2-tz.c
@@ -174,8 +174,7 @@ static MemoryRegion *make_unimp_dev(MPS2TZMachineState *mms,
*/
UnimplementedDeviceState *uds = opaque;
- sysbus_init_child_obj(OBJECT(mms), name, uds,
- sizeof(UnimplementedDeviceState),
+ sysbus_init_child_obj(OBJECT(mms), name, uds, sizeof(*uds),
TYPE_UNIMPLEMENTED_DEVICE);
qdev_prop_set_string(DEVICE(uds), "name", name);
qdev_prop_set_uint64(DEVICE(uds), "size", size);
@@ -552,7 +551,7 @@ static void mps2tz_common_init(MachineState *machine)
char *gpioname;
sysbus_init_child_obj(OBJECT(machine), ppcinfo->name, ppc,
- sizeof(TZPPC), TYPE_TZ_PPC);
+ sizeof(*ppc), TYPE_TZ_PPC);
ppcdev = DEVICE(ppc);
for (port = 0; port < TZ_NUM_PORTS; port++) {