[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aO9gmGMCMncoxCKr@BLRRASHENOY1.amd.com>
Date: Wed, 15 Oct 2025 14:21:36 +0530
From: "Gautham R. Shenoy" <gautham.shenoy@....com>
To: "Mario Limonciello (AMD)" <superm1@...nel.org>
Cc: Perry Yuan <perry.yuan@....com>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <linux-kernel@...r.kernel.org>,
"open list:CPU FREQUENCY SCALING FRAMEWORK" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v2 3/6] cpufreq/amd-pstate: Make
amd_pstate_get_mode_string() never return NULL
On Thu, Oct 09, 2025 at 11:17:53AM -0500, Mario Limonciello (AMD) wrote:
> amd_pstate_get_mode_string() is only used by amd-pstate-ut. Set the
> failure path to use AMD_PSTATE_UNDEFINED ("undefined") to avoid showing
> "(null)" as a string when running test suite.
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@....com>
>
> Signed-off-by: Mario Limonciello (AMD) <superm1@...nel.org>
> ---
> drivers/cpufreq/amd-pstate.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index a5b9e5baf4234..5feb9f5e3a491 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -70,8 +70,8 @@ static_assert(ARRAY_SIZE(amd_pstate_mode_string) == AMD_PSTATE_MAX);
>
> const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)
> {
> - if (mode < 0 || mode >= AMD_PSTATE_MAX)
> - return NULL;
> + if (mode < AMD_PSTATE_UNDEFINED || mode >= AMD_PSTATE_MAX)
> + mode = AMD_PSTATE_UNDEFINED;
> return amd_pstate_mode_string[mode];
> }
> EXPORT_SYMBOL_GPL(amd_pstate_get_mode_string);
> --
> 2.43.0
>
Powered by blists - more mailing lists