Its always set by ->init() and so it will always be there in ->exit(). There is no need to have a special check for just that.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- drivers/cpufreq/acpi-cpufreq.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index eb2196f9d7fa..e20cbb1317cc 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -847,13 +847,11 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
pr_debug("acpi_cpufreq_cpu_exit\n");
- if (data) { - policy->driver_data = NULL; - acpi_processor_unregister_performance(data->acpi_perf_cpu); - free_cpumask_var(data->freqdomain_cpus); - kfree(policy->freq_table); - kfree(data); - } + policy->driver_data = NULL; + acpi_processor_unregister_performance(data->acpi_perf_cpu); + free_cpumask_var(data->freqdomain_cpus); + kfree(policy->freq_table); + kfree(data);
return 0; }
On Wed, Mar 30, 2016 at 6:24 AM, Viresh Kumar viresh.kumar@linaro.org wrote:
Its always set by ->init() and so it will always be there in ->exit(). There is no need to have a special check for just that.
I'm not sure what happens if there are two (or more) CPUs in the policy, though.
That case is almost certainly handled incorrectly here (or rather not handled at all), but it may just happen to sort of work, because the first exiting CPU will clear driver_data and the second one will notice that it is NULL now. Of course, that still is racy with respect to governors etc, but I'd rather fix the driver properly.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org
drivers/cpufreq/acpi-cpufreq.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index eb2196f9d7fa..e20cbb1317cc 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -847,13 +847,11 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
pr_debug("acpi_cpufreq_cpu_exit\n");
if (data) {
policy->driver_data = NULL;
acpi_processor_unregister_performance(data->acpi_perf_cpu);
free_cpumask_var(data->freqdomain_cpus);
kfree(policy->freq_table);
kfree(data);
}
policy->driver_data = NULL;
acpi_processor_unregister_performance(data->acpi_perf_cpu);
free_cpumask_var(data->freqdomain_cpus);
kfree(policy->freq_table);
kfree(data); return 0;
}
2.7.1.410.g6faf27b
-- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Mar 30, 2016 at 1:15 PM, Rafael J. Wysocki rafael@kernel.org wrote:
On Wed, Mar 30, 2016 at 6:24 AM, Viresh Kumar viresh.kumar@linaro.org wrote:
Its always set by ->init() and so it will always be there in ->exit(). There is no need to have a special check for just that.
I'm not sure what happens if there are two (or more) CPUs in the policy, though.
That case is almost certainly handled incorrectly here (or rather not handled at all), but it may just happen to sort of work, because the first exiting CPU will clear driver_data and the second one will notice that it is NULL now. Of course, that still is racy with respect to governors etc, but I'd rather fix the driver properly.
Sorry, scratch that. To core only calls ->exit for the last CPU in the policy, so I agree with the patch.
It conflicts with other stuff (as you know), so I'm not sure about the order in which they are going to be applied, though.
Thanks, Rafael
On 30-03-16, 13:18, Rafael J. Wysocki wrote:
It conflicts with other stuff (as you know), so I'm not sure about the order in which they are going to be applied, though.
Yeah, I know. I noticed the ugliness only after looking at your changes :)
I am fine to rebase them over if you want. Its really trivial.
On 30-03-16, 13:18, Rafael J. Wysocki wrote:
It conflicts with other stuff (as you know), so I'm not sure about the order in which they are going to be applied, though.
Please let me know when can I rebase and resend this one. I saw that you have moved your patches to linux-next now.
On Friday, April 01, 2016 01:52:54 PM Viresh Kumar wrote:
On 30-03-16, 13:18, Rafael J. Wysocki wrote:
It conflicts with other stuff (as you know), so I'm not sure about the order in which they are going to be applied, though.
Please let me know when can I rebase and resend this one. I saw that you have moved your patches to linux-next now.
I have, but they need to be rebased on top of 2 intel_pstate fixes I want to push for v4.6 still and some more minor changes will be necessary.
I guess next week will be the right time kind of, but I will be traveling 10-17 Apr, so I may not have much time to process stuff.
Thanks, Rafael
On 30-03-16, 13:15, Rafael J. Wysocki wrote:
On Wed, Mar 30, 2016 at 6:24 AM, Viresh Kumar viresh.kumar@linaro.org wrote:
Its always set by ->init() and so it will always be there in ->exit(). There is no need to have a special check for just that.
I'm not sure what happens if there are two (or more) CPUs in the policy, though.
That case is almost certainly handled incorrectly here (or rather not handled at all), but it may just happen to sort of work, because the first exiting CPU will clear driver_data and the second one will notice that it is NULL now. Of course, that still is racy with respect to governors etc, but I'd rather fix the driver properly.
Sorry, I probably didn't understood your comments properly.
But, the core will call ->exit() only for the last exiting CPU. So, driver_data will never be NULL.
linaro-kernel@lists.linaro.org