Skip to contentSkip to conversation

asus-wmi: delete impossible condition

PATCH In review Dan Carpenter 2 participants 2 messages Aug 24, 2021 – Aug 26, 2021

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

PATCH 1/1 asus-wmi: delete impossible condition

The "asus->throttle_thermal_policy_mode" variable is a u8 so it can't be negative. And we always verify that the value is valid before setting the policy mode so there is no need to check again here.

---
 drivers/platform/x86/asus-wmi.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/platform/x86/asus-wmi.c +0 -3
index cc5811844012..679429d41264 100644
@@ -2179,9 +2179,6 @@ static int platform_profile_get(struct platform_profile_handler *pprof,
 
 	tp = asus->throttle_thermal_policy_mode;
 
-	if (tp < 0)
-		return tp;
-
 	switch (tp) {
 	case ASUS_THROTTLE_THERMAL_POLICY_DEFAULT:
 		*profile = PLATFORM_PROFILE_BALANCED;
Signature · 1 line
2.20.1
#1 lore raw

Hi,

Quoted 5 lines · Dan Carpenter

The "asus->throttle_thermal_policy_mode" variable is a u8 so it can't be negative. And we always verify that the value is valid before setting the policy mode so there is no need to check again here.

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 19 lines
---
 drivers/platform/x86/asus-wmi.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/platform/x86/asus-wmi.c +0 -3
index cc5811844012..679429d41264 100644
@@ -2179,9 +2179,6 @@ static int platform_profile_get(struct platform_profile_handler *pprof,
 
 	tp = asus->throttle_thermal_policy_mode;
 
-	if (tp < 0)
-		return tp;
-
 	switch (tp) {
 	case ASUS_THROTTLE_THERMAL_POLICY_DEFAULT:
 		*profile = PLATFORM_PROFILE_BALANCED;