]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
spapr: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
authorGreg Kurz <groug@kaod.org>
Tue, 27 Nov 2018 13:05:18 +0000 (14:05 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 20 Dec 2018 22:24:23 +0000 (09:24 +1100)
Because it is a recommended coding practice (see HACKING).

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_iommu.c
hw/ppc/spapr_vio.c

index 1b0880ac9edb39d1f9fb1a31aa25746e1bea7687..b56466f89a64ff7fa0f7243fe60533e9c8252f97 100644 (file)
@@ -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);
index 840d4a3c451cb923d19bffa0e62c3f2bebe18542..7e8a9ad0933783347cb0d91c6f6986b881a37bd4 100644 (file)
@@ -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;