Skip to content

Commit 92d6146

Browse files
committed
cpufreq/amd-pstate: Adjust return values in amd_pstate_update_status()
get_mode_idx_from_str() already checks the upper boundary for a string sent. Drop the extra check in amd_pstate_update_status() and pass the return code if there is a failure. Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
1 parent baf106f commit 92d6146

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/cpufreq/amd-pstate.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,9 +1346,8 @@ int amd_pstate_update_status(const char *buf, size_t size)
13461346
return -EINVAL;
13471347

13481348
mode_idx = get_mode_idx_from_str(buf, size);
1349-
1350-
if (mode_idx < 0 || mode_idx >= AMD_PSTATE_MAX)
1351-
return -EINVAL;
1349+
if (mode_idx < 0)
1350+
return mode_idx;
13521351

13531352
if (mode_state_machine[cppc_state][mode_idx]) {
13541353
guard(mutex)(&amd_pstate_driver_lock);

0 commit comments

Comments
 (0)