Skip to content

Commit baf106f

Browse files
committed
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>
1 parent 06791bc commit baf106f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/cpufreq/amd-pstate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ static_assert(ARRAY_SIZE(amd_pstate_mode_string) == AMD_PSTATE_MAX);
7070

7171
const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)
7272
{
73-
if (mode < 0 || mode >= AMD_PSTATE_MAX)
74-
return NULL;
73+
if (mode < AMD_PSTATE_UNDEFINED || mode >= AMD_PSTATE_MAX)
74+
mode = AMD_PSTATE_UNDEFINED;
7575
return amd_pstate_mode_string[mode];
7676
}
7777
EXPORT_SYMBOL_GPL(amd_pstate_get_mode_string);

0 commit comments

Comments
 (0)