2024-04-12 08:42:02

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH V2] cpufreq: Always clear freq_table pointer

The freq_table pointer must be cleared even if the exit() callback isn't
present.

Signed-off-by: Viresh Kumar <[email protected]>
---
V2:

- Dropping the other change as it is covered by:

https://lore.kernel.org/all/[email protected]/

drivers/cpufreq/cpufreq.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 66e10a19d76a..13980cb0527a 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1679,10 +1679,13 @@ static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy)
*/
if (cpufreq_driver->offline) {
cpufreq_driver->offline(policy);
- } else if (cpufreq_driver->exit) {
- cpufreq_driver->exit(policy);
- policy->freq_table = NULL;
+ return;
}
+
+ if (cpufreq_driver->exit)
+ cpufreq_driver->exit(policy);
+
+ policy->freq_table = NULL;
}

static int cpufreq_offline(unsigned int cpu)
--
2.31.1.272.g89b43f80a514