summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Limonciello (AMD) <superm1@kernel.org>2025-10-09 11:17:53 -0500
committerMario Limonciello (AMD) <superm1@kernel.org>2025-11-10 23:35:20 -0600
commitbaf106f3a7ba8bf317e1f9d32ee88955723cbc71 (patch)
tree065d1bd61563f961dd7a9854934bc3c0560243a6
parent06791bc017ea0793dae71553163c9107e91c415b (diff)
cpufreq/amd-pstate: Make amd_pstate_get_mode_string() never return NULL
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@amd.com> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
-rw-r--r--drivers/cpufreq/amd-pstate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index a5b9e5baf423..5feb9f5e3a49 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);