[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH for-4.0 2/9] spapr: use g_new(T, n) instead of g_mallo
From: |
Greg Kurz |
Subject: |
[Qemu-ppc] [PATCH for-4.0 2/9] spapr: use g_new(T, n) instead of g_malloc(sizeof(T) * n) |
Date: |
Tue, 27 Nov 2018 14:05:18 +0100 |
User-agent: |
StGit/unknown-version |
Because it is a recommended coding practice (see HACKING).
Signed-off-by: Greg Kurz <address@hidden>
---
hw/ppc/spapr_iommu.c | 2 +-
hw/ppc/spapr_vio.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index 1b0880ac9edb..b56466f89a64 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -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);
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 840d4a3c451c..7e8a9ad09337 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -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;
- [Qemu-ppc] [PATCH for-4.0 0/9] ppc: get rid of g_malloc(sizeof(T) * n), Greg Kurz, 2018/11/27
- [Qemu-ppc] [PATCH for-4.0 4/9] ppc405_uc: use g_new(T, n) instead of g_malloc(sizeof(T) * n), Greg Kurz, 2018/11/27
- [Qemu-ppc] [PATCH for-4.0 5/9] ppc440_bamboo: use g_new(T, n) instead of g_malloc(sizeof(T) * n), Greg Kurz, 2018/11/27
- [Qemu-ppc] [PATCH for-4.0 6/9] sam460ex: use g_new(T, n) instead of g_malloc(sizeof(T) * n), Greg Kurz, 2018/11/27