From: Gautham R.Shenoy <gautham.shenoy@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>, <perry.yuan@amd.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Mario Limonciello" <mario.limonciello@amd.com>,
<alex.s.cochran@proton.me>,
"Peter Jung" <peterjung1337@gmail.com>
Subject: Re: [PATCH] cpufreq: amd-pstate: Don't create attributes when registration fails
Date: Mon, 24 Jun 2024 10:10:50 +0530 [thread overview]
Message-ID: <87h6dj3qct.fsf@BLR-5CG11610CF.amd.com> (raw)
In-Reply-To: <20240623200918.52104-1-mario.limonciello@amd.com>
Mario Limonciello <mario.limonciello@amd.com> writes:
> If driver registration fails then immediately return the failure
> instead of continuing to register attributes.
>
> This fixes issues of falling back from amd-pstate to other drivers
> when cpufreq init has failed for any reason.
>
> Reported-by: alex.s.cochran@proton.me
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Thanks for fixing this.
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
> ---
> Cc: Peter Jung <peterjung1337@gmail.com>
> drivers/cpufreq/amd-pstate.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 05e80d2f8803..7195dfa98cc5 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -2030,8 +2030,10 @@ static int __init amd_pstate_init(void)
> }
>
> ret = cpufreq_register_driver(current_pstate_driver);
> - if (ret)
> + if (ret) {
> pr_err("failed to register with return %d\n", ret);
> + goto disable_driver;
> + }
>
> dev_root = bus_get_dev_root(&cpu_subsys);
> if (dev_root) {
> @@ -2047,6 +2049,8 @@ static int __init amd_pstate_init(void)
>
> global_attr_free:
> cpufreq_unregister_driver(current_pstate_driver);
> +disable_driver:
> + amd_pstate_enable(false);
> return ret;
> }
> device_initcall(amd_pstate_init);
> --
> 2.43.0
prev parent reply other threads:[~2024-06-24 4:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-23 20:09 [PATCH] cpufreq: amd-pstate: Don't create attributes when registration fails Mario Limonciello
2024-06-24 3:32 ` Yuan, Perry
2024-06-24 4:40 ` Gautham R.Shenoy [this message]
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=87h6dj3qct.fsf@BLR-5CG11610CF.amd.com \
--to=gautham.shenoy@amd.com \
--cc=alex.s.cochran@proton.me \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=perry.yuan@amd.com \
--cc=peterjung1337@gmail.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