diff mbox series

[83/88] hw/pci: use g_new() family of functions

Message ID 20171006235023.11952-84-f4bug@amsat.org
State New
Headers show
Series use g_new() family of functions | expand

Commit Message

Philippe Mathieu-Daudé Oct. 6, 2017, 11:50 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci/pci.c          | 2 +-
 hw/pci/pcie_port.c    | 2 +-
 tests/libqos/pci-pc.c | 2 +-
 tests/libqos/pci.c    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 1e6fb88eba..32625d9fcc 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1644,7 +1644,7 @@  static PciMemoryRegionList *qmp_query_pci_regions(const PCIDevice *dev)
             continue;
         }
 
-        region = g_malloc0(sizeof(*region));
+        region = g_new0(PciMemoryRegionList, 1);
         region->value = g_malloc0(sizeof(*region->value));
 
         if (r->type & PCI_BASE_ADDRESS_SPACE_IO) {
diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c
index 6432b9ac1f..236d8bc4db 100644
--- a/hw/pci/pcie_port.c
+++ b/hw/pci/pcie_port.c
@@ -72,7 +72,7 @@  void pcie_chassis_create(uint8_t chassis_number)
     if (c) {
         return;
     }
-    c = g_malloc0(sizeof(*c));
+    c = g_new0(struct PCIEChassis, 1);
     c->number = chassis_number;
     QLIST_INIT(&c->slots);
     QLIST_INSERT_HEAD(&chassis, c, next);
diff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c
index ded1c54c06..cde5e0a627 100644
--- a/tests/libqos/pci-pc.c
+++ b/tests/libqos/pci-pc.c
@@ -119,7 +119,7 @@  QPCIBus *qpci_init_pc(QGuestAllocator *alloc)
 {
     QPCIBusPC *ret;
 
-    ret = g_malloc(sizeof(*ret));
+    ret = g_new(QPCIBusPC, 1);
 
     ret->bus.pio_readb = qpci_pc_pio_readb;
     ret->bus.pio_readw = qpci_pc_pio_readw;
diff --git a/tests/libqos/pci.c b/tests/libqos/pci.c
index 0b73cb23d0..9dd689c7b5 100644
--- a/tests/libqos/pci.c
+++ b/tests/libqos/pci.c
@@ -54,7 +54,7 @@  QPCIDevice *qpci_device_find(QPCIBus *bus, int devfn)
 {
     QPCIDevice *dev;
 
-    dev = g_malloc0(sizeof(*dev));
+    dev = g_new0(QPCIDevice, 1);
     dev->bus = bus;
     dev->devfn = devfn;