lkml.org 
[lkml]   [2021]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] acpi-cpufreq: Skip cleanup if initialization didn't occur
On 04-06-21, 12:05, kyle.meyer@hpe.com wrote:
> From: Kyle Meyer <kyle.meyer@hpe.com>
>
> acpi-cpufreq is loaded without performing initialization when a cpufreq
> driver exists.
>
> If initialization didn't occur then skip cleanup in acpi_cpufreq_exit().
> This prevents unnecessary freeing and unregistering when the module is
> unloaded.
>
> Reported-by: Takashi Iwai <tiwai@suse.com>
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
> ---
> drivers/cpufreq/acpi-cpufreq.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 7e7450453714..8d425f14c267 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -1042,8 +1042,19 @@ static int __init acpi_cpufreq_init(void)
>
> static void __exit acpi_cpufreq_exit(void)
> {
> + const char *current_driver;
> +
> pr_debug("%s\n", __func__);
>
> + /*
> + * If another cpufreq_driver was loaded, preventing acpi-cpufreq from
> + * registering, there's no need to unregister it.
> + */
> + current_driver = cpufreq_get_current_driver();
> + if (!current_driver ||
> + strncmp(current_driver, acpi_cpufreq_driver.name, strlen(acpi_cpufreq_driver.name)))
> + return;
> +
> acpi_cpufreq_boost_exit();
>
> cpufreq_unregister_driver(&acpi_cpufreq_driver);

Looks like some misunderstanding here, this shouldn't happen. If
initialization didn't occur, then exit shall never be called.

--
viresh

\
 
 \ /
  Last update: 2021-06-07 05:26    [W:0.083 / U:0.800 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site