From: Viresh Kumar <viresh.kumar@linaro.org>
To: kyle.meyer@hpe.com
Cc: rjw@rjwysocki.net, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] acpi-cpufreq: Skip cleanup if initialization didn't occur
Date: Mon, 7 Jun 2021 08:55:50 +0530 [thread overview]
Message-ID: <20210607032550.qdnl2sxnny42rtwa@vireshk-i7> (raw)
In-Reply-To: <20210604170500.46875-1-kyle.meyer@hpe.com>
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
next prev parent reply other threads:[~2021-06-07 3:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 17:05 [PATCH] acpi-cpufreq: Skip cleanup if initialization didn't occur kyle.meyer
2021-06-07 3:25 ` Viresh Kumar [this message]
2021-06-07 7:13 ` Takashi Iwai
2021-06-07 7:26 ` Viresh Kumar
2021-06-07 11:09 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210607032550.qdnl2sxnny42rtwa@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=kyle.meyer@hpe.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).