Skip to contentSkip to conversation

platform/x86: hp-wmi: simplify the return expression of platform_profile_omen_set()

PATCH In review [email protected] 2 participants 2 messages May 5, 2022 – May 6, 2022 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: hp-wmi: simplify the return expression of platform_profile_omen_set()

From: Minghao Chi <[email protected]>

Simplify the return expression.

---
 drivers/platform/x86/hp-wmi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/platform/x86/hp-wmi.c +2 -6
index 667f94bba905..9edb1f877189 100644
@@ -1119,7 +1119,7 @@ static int platform_profile_omen_get(struct platform_profile_handler *pprof,
 static int platform_profile_omen_set(struct platform_profile_handler *pprof,
 				     enum platform_profile_option profile)
 {
-	int err, tp, tp_version;
+	int tp, tp_version;
 
 	tp_version = omen_get_thermal_policy_version();
 
@@ -1149,11 +1149,7 @@ static int platform_profile_omen_set(struct platform_profile_handler *pprof,
 		return -EOPNOTSUPP;
 	}
 
-	err = omen_thermal_profile_set(tp);
-	if (err < 0)
-		return err;
-
-	return 0;
+	return omen_thermal_profile_set(tp);
 }
 
 static int thermal_profile_get(void)
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 6 lines · On 5/5/22 04:19, [email protected] wrote:

From: Minghao Chi <[email protected]>

Simplify the return expression.

omen_thermal_profile_set(tp) returns the value of tp on success which is not necessarily always 0, so this patch is invalid.

Regards,

Hans

Quoted 30 lines
---
 drivers/platform/x86/hp-wmi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/platform/x86/hp-wmi.c +2 -6
index 667f94bba905..9edb1f877189 100644
@@ -1119,7 +1119,7 @@ static int platform_profile_omen_get(struct platform_profile_handler *pprof,
 static int platform_profile_omen_set(struct platform_profile_handler *pprof,
 				     enum platform_profile_option profile)
 {
-	int err, tp, tp_version;
+	int tp, tp_version;
 
 	tp_version = omen_get_thermal_policy_version();
 
@@ -1149,11 +1149,7 @@ static int platform_profile_omen_set(struct platform_profile_handler *pprof,
 		return -EOPNOTSUPP;
 	}
 
-	err = omen_thermal_profile_set(tp);
-	if (err < 0)
-		return err;
-
-	return 0;
+	return omen_thermal_profile_set(tp);
 }
 
 static int thermal_profile_get(void)