Commit 6acddeaf authored by Zhi Tongze's avatar Zhi Tongze Committed by guzitao
Browse files

sw64: fix the error of cpufreq update

Sunway inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB73UR



--------------------------------

When adjusting the cpu frequency, if 0 is returned, it is a correct
execution return. if a non-zero value is returned, it is an incorrect
execution return. the current logic is wrong and has been fixed.

Signed-off-by: default avatarZhi Tongze <zhitongze@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent d5fb8c22
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -66,13 +66,16 @@ static unsigned int sw64_cpufreq_get(unsigned int cpu)
static int sw64_cpufreq_target(struct cpufreq_policy *policy,
				     unsigned int index)
{
	int ret;
	unsigned int cpu = policy->cpu;

	if (!cpu_online(cpu))
		return -ENODEV;

	/* setting the cpu frequency */
	sw64_set_rate(index);
	ret = sw64_set_rate(index);
	if (ret)
		return ret;
	update_cpu_freq(freq_table[index].frequency);

	return 0;