mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
ACPI: processor: idle: Reset power_setup_done flag on initialization failure
The 'power_setup_done' flag is a key indicator used across the ACPI processor driver to determine if cpuidle are properly configured and available for a given CPU. Currently, this flag is set during the early stages of initialization. However, if the subsequent registration of the cpuidle driver in acpi_processor_register_idle_driver() or the per-CPU device registration in acpi_processor_power_init() fails, this flag remains set. This may lead to some issues where other functions in ACPI idle driver use these flags. Fix this by explicitly resetting this flag to 0 in these error paths. Signed-off-by: Huisong Li <lihuisong@huawei.com> Link: https://patch.msgid.link/20260403085343.866440-1-lihuisong@huawei.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
00154eede7
commit
02c68ed11c
|
|
@ -1379,6 +1379,7 @@ void acpi_processor_register_idle_driver(void)
|
|||
|
||||
ret = cpuidle_register_driver(&acpi_idle_driver);
|
||||
if (ret) {
|
||||
pr->flags.power_setup_done = 0;
|
||||
pr_debug("register %s failed.\n", acpi_idle_driver.name);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1387,7 +1388,16 @@ void acpi_processor_register_idle_driver(void)
|
|||
|
||||
void acpi_processor_unregister_idle_driver(void)
|
||||
{
|
||||
struct acpi_processor *pr;
|
||||
int cpu;
|
||||
|
||||
cpuidle_unregister_driver(&acpi_idle_driver);
|
||||
for_each_possible_cpu(cpu) {
|
||||
pr = per_cpu(processors, cpu);
|
||||
if (!pr)
|
||||
continue;
|
||||
pr->flags.power_setup_done = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void acpi_processor_power_init(struct acpi_processor *pr)
|
||||
|
|
@ -1424,6 +1434,7 @@ void acpi_processor_power_init(struct acpi_processor *pr)
|
|||
*/
|
||||
if (cpuidle_register_device(dev)) {
|
||||
per_cpu(acpi_cpuidle_device, pr->id) = NULL;
|
||||
pr->flags.power_setup_done = 0;
|
||||
kfree(dev);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user