From: Philippe Mathieu-Daudé Date: Sat, 25 Jan 2025 17:24:39 +0000 (+0100) Subject: hw/sysbus: Use sizeof(BusState) in main_system_bus_create() X-Git-Tag: v10.0.0-rc0~48^2~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4194e19cc202774251ae03a1658077fd954797f;p=thirdparty%2Fqemu.git hw/sysbus: Use sizeof(BusState) in main_system_bus_create() Rather than using the obscure system_bus_info.instance_size, directly use sizeof(BusState). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alexander Graf Reviewed-by: Clément Mathieu--Drif Message-Id: <20250125181343.59151-2-philmd@linaro.org> --- diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 9355849ff0..f713bbfe04 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; }