[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/9] hw/sysbus: Use sizeof(BusState) in main_system_bus_create()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 1/9] hw/sysbus: Use sizeof(BusState) in main_system_bus_create() |
Date: |
Sat, 25 Jan 2025 19:13:35 +0100 |
Rather than using the obscure system_bus_info.instance_size,
directly use sizeof(BusState).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/sysbus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 9355849ff0a..f713bbfe04f 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -323,8 +323,8 @@ static void main_system_bus_create(void)
* assign main_system_bus before qbus_init()
* in order to make "if (bus != sysbus_get_default())" work
*/
- main_system_bus = g_malloc0(system_bus_info.instance_size);
- qbus_init(main_system_bus, system_bus_info.instance_size,
+ main_system_bus = g_new0(BusState, 1);
+ qbus_init(main_system_bus, sizeof(BusState),
TYPE_SYSTEM_BUS, NULL, "main-system-bus");
OBJECT(main_system_bus)->free = g_free;
}
--
2.47.1
- [PATCH 0/9] hw/sysbus/platform-bus: Introduce TYPE_DYNAMIC_SYS_BUS_DEVICE, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH 1/9] hw/sysbus: Use sizeof(BusState) in main_system_bus_create(),
Philippe Mathieu-Daudé <=
- [PATCH 2/9] hw/sysbus: Declare QOM types using DEFINE_TYPES() macro, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH 3/9] hw/sysbus: Introduce TYPE_DYNAMIC_SYS_BUS_DEVICE, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH 5/9] hw/display: Have RAMFB device inherit from DYNAMIC_SYS_BUS_DEVICE, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH 4/9] hw/vfio: Have VFIO_PLATFORM devices inherit from DYNAMIC_SYS_BUS_DEVICE, Philippe Mathieu-Daudé, 2025/01/25
- [PATCH 6/9] hw/i386: Have X86_IOMMU devices inherit from DYNAMIC_SYS_BUS_DEVICE, Philippe Mathieu-Daudé, 2025/01/25