From 569786d7c883154effcb215bd74f30f680f9e540 Mon Sep 17 00:00:00 2001 From: Xianglai Li Date: Wed, 30 Jul 2025 16:03:57 +0800 Subject: [PATCH] hw/acpi: Fix the memory leak issue During the creation process of the acpi ged device, the function cpu_hotplug_hw_init was wrongly called multiple times, resulting in a memory leak. Now, delete the redundant calls of the function cpu_hotplug_hw_init to solve the memory leak problem. Fixes: ac96f2161550 ("hw/acpi: Update ACPI GED framework to support vCPU Hotplug") Fixes: 6e17d32d6df2 ("acpi/ged: Init cpu hotplug only when machine support it") Signed-off-by: Xianglai Li --- hw/acpi/generic_event_device.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 755653dc265..61a4c9e643c 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -439,7 +439,6 @@ static void acpi_ged_initfn(Object *obj) AcpiGedState *s = ACPI_GED(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); GEDState *ged_st = &s->ged_state; - MachineClass *mc; memory_region_init_io(&ged_st->evt, obj, &ged_evt_ops, ged_st, TYPE_ACPI_GED, ACPI_GED_EVT_SEL_LEN); @@ -463,15 +462,6 @@ static void acpi_ged_initfn(Object *obj) memory_region_init_io(&ged_st->regs, obj, &ged_regs_ops, ged_st, TYPE_ACPI_GED "-regs", ACPI_GED_REG_COUNT); sysbus_init_mmio(sbd, &ged_st->regs); - - mc = MACHINE_GET_CLASS(qdev_get_machine()); - if (mc->possible_cpu_arch_ids) { - memory_region_init(&s->container_cpuhp, OBJECT(dev), "cpuhp container", - ACPI_CPU_HOTPLUG_REG_LEN); - sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->container_cpuhp); - cpu_hotplug_hw_init(&s->container_cpuhp, OBJECT(dev), - &s->cpuhp_state, 0); - } } static void acpi_ged_class_init(ObjectClass *class, void *data) -- Gitee