Merge tag 'thermal-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal...
[platform/kernel/linux-starfive.git] / drivers / thermal / cpufreq_cooling.c
index 4ae8c85..e297e13 100644 (file)
@@ -273,7 +273,7 @@ static int cpufreq_state2power(struct thermal_cooling_device *cdev,
        struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
 
        /* Request state should be less than max_level */
-       if (WARN_ON(state > cpufreq_cdev->max_level))
+       if (state > cpufreq_cdev->max_level)
                return -EINVAL;
 
        num_cpus = cpumask_weight(cpufreq_cdev->policy->cpus);
@@ -437,7 +437,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
        int ret;
 
        /* Request state should be less than max_level */
-       if (WARN_ON(state > cpufreq_cdev->max_level))
+       if (state > cpufreq_cdev->max_level)
                return -EINVAL;
 
        /* Check if the old cooling action is same as new cooling action */
@@ -456,6 +456,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
                capacity = frequency * max_capacity;
                capacity /= cpufreq_cdev->policy->cpuinfo.max_freq;
                arch_set_thermal_pressure(cpus, max_capacity - capacity);
+               ret = 0;
        }
 
        return ret;