[PATCH] thermal/cpufreq_cooling: Simplify cpufreq_set_cur_state()

Thorsten Blum posted 1 patch 17 hours ago
drivers/thermal/cpufreq_cooling.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
[PATCH] thermal/cpufreq_cooling: Simplify cpufreq_set_cur_state()
Posted by Thorsten Blum 17 hours ago
Return freq_qos_update_request() errors directly to simplify the code.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/thermal/cpufreq_cooling.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index 768859a7aed0..e89036077bef 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -488,12 +488,12 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
 	frequency = get_state_freq(cpufreq_cdev, state);
 
 	ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency);
-	if (ret >= 0) {
-		cpufreq_cdev->cpufreq_state = state;
-		ret = 0;
-	}
+	if (ret < 0)
+		return ret;
+
+	cpufreq_cdev->cpufreq_state = state;
 
-	return ret;
+	return 0;
 }
 
 /**