Skip to contentSkip to conversation

thermal/cpufreq_cooling: Simplify cpufreq_set_cur_state()

PATCH Applied Thorsten Blum 2 participants 2 messages Sep 23 – Sep 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal/cpufreq_cooling: Simplify cpufreq_set_cur_state()

Return freq_qos_update_request() errors directly to simplify the code.

---
 drivers/thermal/cpufreq_cooling.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/thermal/cpufreq_cooling.c +5 -5
index 768859a7aed0..e89036077bef 100644
@@ -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;
 }
 
 /**
maintainer Applied
#1 lore raw
Quoted 20 lines · Thorsten Blum

Return freq_qos_update_request() errors directly to simplify the code.

---
 drivers/thermal/cpufreq_cooling.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/thermal/cpufreq_cooling.c +0 -4
index 768859a7aed0..e89036077bef 100644
@@ -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;
-       }

drivers/thermal/cpufreq_cooling.c static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, · line 499

Quoted 10 lines
drivers/thermal/cpufreq_cooling.c +5 -1
+       if (ret < 0)
+               return ret;
+
+       cpufreq_cdev->cpufreq_state = state;
 
-       return ret;
+       return 0;
 }
 
 /**

Applied as 7.4 material, thanks!