Skip to contentSkip to conversation

ACPI: processor: Unregister cpufreq notifier on init failure

PATCH Applied Can Peng 2 participants 2 messages Jul 29 – Jul 31 ACPI

lore
Share & tools
lore

Can Peng

author
#0 lore raw

PATCH 1/1 ACPI: processor: Unregister cpufreq notifier on init failure

acpi_processor_driver_init() registers the cpufreq policy notifier before registering the ACPI processor driver and setting up CPU hotplug state.

If driver_register() or cpuhp_setup_state() fails, the error path only unregisters the ACPI processor driver and the idle driver. The cpufreq notifier remains registered even though initialization failed.

Mirror the module exit path on the init failure path and unregister the cpufreq notifier when it has been registered.

Fixes c0e0421a60bf ("ACPI: processor: Reorder acpi_processor_driver_init()")
---
 drivers/acpi/processor_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/processor_driver.c +6 -0
index cda8fd720000..cdc2ae1632b2 100644
@@ -285,6 +285,12 @@ static int __init acpi_processor_driver_init(void)
 unregister_idle_drv:
 	acpi_processor_unregister_idle_driver();
 
+	if (acpi_processor_cpufreq_init) {
+		cpufreq_unregister_notifier(&acpi_processor_notifier_block,
+					    CPUFREQ_POLICY_NOTIFIER);
+		acpi_processor_cpufreq_init = false;
+	}
+
 	return result;
 }
 
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 25 lines · Can Peng

acpi_processor_driver_init() registers the cpufreq policy notifier before registering the ACPI processor driver and setting up CPU hotplug state.

If driver_register() or cpuhp_setup_state() fails, the error path only unregisters the ACPI processor driver and the idle driver. The cpufreq notifier remains registered even though initialization failed.

Mirror the module exit path on the init failure path and unregister the cpufreq notifier when it has been registered.

Fixes c0e0421a60bf ("ACPI: processor: Reorder acpi_processor_driver_init()")
---
 drivers/acpi/processor_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/processor_driver.c +0 -0
index cda8fd720000..cdc2ae1632b2 100644
@@ -285,6 +285,12 @@ static int __init acpi_processor_driver_init(void)
 unregister_idle_drv:
        acpi_processor_unregister_idle_driver();
 

drivers/acpi/processor_driver.c static int __init acpi_processor_driver_init(void)

Quoted 10 lines
drivers/acpi/processor_driver.c +6 -1
+       if (acpi_processor_cpufreq_init) {
+               cpufreq_unregister_notifier(&acpi_processor_notifier_block,
+                                           CPUFREQ_POLICY_NOTIFIER);
+               acpi_processor_cpufreq_init = false;
+       }
+
        return result;
 }
 
--

Applied as 7.3 material, thanks!