Commit 5408211a authored by Dietmar Eggemann's avatar Dietmar Eggemann Committed by Rafael J. Wysocki

drivers base/arch_topology: free cpumask cpus_to_visit

Free cpumask cpus_to_visit in case registering
init_cpu_capacity_notifier has failed or the parsing of the cpu
capacity-dmips-mhz property is done. The cpumask cpus_to_visit is
only used inside the notifier call init_cpu_capacity_callback.
Reported-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Tested-by: default avatarJuri Lelli <juri.lelli@arm.com>
Reviewed-by: default avatarJuri Lelli <juri.lelli@arm.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 9e66317d
...@@ -212,6 +212,8 @@ static struct notifier_block init_cpu_capacity_notifier = { ...@@ -212,6 +212,8 @@ static struct notifier_block init_cpu_capacity_notifier = {
static int __init register_cpufreq_notifier(void) static int __init register_cpufreq_notifier(void)
{ {
int ret;
/* /*
* on ACPI-based systems we need to use the default cpu capacity * on ACPI-based systems we need to use the default cpu capacity
* until we have the necessary code to parse the cpu capacity, so * until we have the necessary code to parse the cpu capacity, so
...@@ -227,8 +229,13 @@ static int __init register_cpufreq_notifier(void) ...@@ -227,8 +229,13 @@ static int __init register_cpufreq_notifier(void)
cpumask_copy(cpus_to_visit, cpu_possible_mask); cpumask_copy(cpus_to_visit, cpu_possible_mask);
return cpufreq_register_notifier(&init_cpu_capacity_notifier, ret = cpufreq_register_notifier(&init_cpu_capacity_notifier,
CPUFREQ_POLICY_NOTIFIER); CPUFREQ_POLICY_NOTIFIER);
if (ret)
free_cpumask_var(cpus_to_visit);
return ret;
} }
core_initcall(register_cpufreq_notifier); core_initcall(register_cpufreq_notifier);
...@@ -236,6 +243,7 @@ static void parsing_done_workfn(struct work_struct *work) ...@@ -236,6 +243,7 @@ static void parsing_done_workfn(struct work_struct *work)
{ {
cpufreq_unregister_notifier(&init_cpu_capacity_notifier, cpufreq_unregister_notifier(&init_cpu_capacity_notifier,
CPUFREQ_POLICY_NOTIFIER); CPUFREQ_POLICY_NOTIFIER);
free_cpumask_var(cpus_to_visit);
} }
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment