Skip to content

Commit 11b3de1

Browse files
LiHuiSong1rafaeljw
authored andcommitted
ACPI: processor: idle: Fix memory leak when register cpuidle device failed
The cpuidle device's memory is leaked when cpuidle device registration fails in acpi_processor_power_init(). Free it as appropriate. Fixes: 3d339dc ("cpuidle / ACPI : move cpuidle_device field out of the acpi_processor_power structure") Signed-off-by: Huisong Li <lihuisong@huawei.com> Link: https://patch.msgid.link/20250728070612.1260859-2-lihuisong@huawei.com [ rjw: Changed the order of the new statements, added empty line after if () ] [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent c17b750 commit 11b3de1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/acpi/processor_idle.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,9 @@ int acpi_processor_power_init(struct acpi_processor *pr)
14051405
if (retval) {
14061406
if (acpi_processor_registered == 0)
14071407
cpuidle_unregister_driver(&acpi_idle_driver);
1408+
1409+
per_cpu(acpi_cpuidle_device, pr->id) = NULL;
1410+
kfree(dev);
14081411
return retval;
14091412
}
14101413
acpi_processor_registered++;

0 commit comments

Comments
 (0)