Skip to content

Commit

Permalink
spapr: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
Browse files Browse the repository at this point in the history
Because it is a recommended coding practice (see HACKING).

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
  • Loading branch information
gkurz authored and dgibson committed Dec 20, 2018
1 parent cc226c0 commit dec4ec4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hw/ppc/spapr_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static uint64_t *spapr_tce_alloc_table(uint32_t liobn,

if (!table) {
*fd = -1;
table = g_malloc0(nb_table * sizeof(uint64_t));
table = g_new0(uint64_t, nb_table);
}

trace_spapr_iommu_new_table(liobn, table, *fd);
Expand Down
2 changes: 1 addition & 1 deletion hw/ppc/spapr_vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ void spapr_dt_vdevice(VIOsPAPRBus *bus, void *fdt)
}

/* Copy out into an array of pointers */
qdevs = g_malloc(sizeof(qdev) * num);
qdevs = g_new(DeviceState *, num);
num = 0;
QTAILQ_FOREACH(kid, &bus->bus.children, sibling) {
qdevs[num++] = kid->child;
Expand Down

0 comments on commit dec4ec4

Please sign in to comment.