Commit 92d6146a authored by Mario Limonciello (AMD)'s avatar Mario Limonciello (AMD)
Browse files

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: default avatarGautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: default avatarMario Limonciello (AMD) <superm1@kernel.org>
parent baf106f3
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1346,9 +1346,8 @@ int amd_pstate_update_status(const char *buf, size_t size)
		return -EINVAL;

	mode_idx = get_mode_idx_from_str(buf, size);

	if (mode_idx < 0 || mode_idx >= AMD_PSTATE_MAX)
		return -EINVAL;
	if (mode_idx < 0)
		return mode_idx;

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