Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1367108

Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit()

From "Rafael J. Wysocki" <rafael@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit()
Date 2016-03-30 13:20 +0200
Message-ID <rimkh-4wo-3@gated-at.bofh.it> (permalink)
References <rifVw-5u-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() Viresh Kumar <viresh.kumar@linaro.org> - 2016-03-30 06:30 +0200
  Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-30 13:20 +0200
    Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in  ->exit() Viresh Kumar <viresh.kumar@linaro.org> - 2016-03-30 13:30 +0200
    Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in  ->exit() Viresh Kumar <viresh.kumar@linaro.org> - 2016-04-01 10:30 +0200
      Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-04-01 23:00 +0200
  Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-30 13:20 +0200
    Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in  ->exit() Viresh Kumar <viresh.kumar@linaro.org> - 2016-03-30 13:30 +0200

csiph-web