Skip to contentSkip to conversation

platform/x86: asus-wmi: Fix condition in charge_threshold_store()

PATCH In review Dan Carpenter 2 participants 3 messages Sep 2, 2019

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

PATCH 1/1 platform/x86: asus-wmi: Fix condition in charge_threshold_store()

This error handling is reversed so we return early.

Fixes 84d8e80b0a36 ("platform/x86: asus-wmi: Refactor charge_threshold_store()")
---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +1 -1
index 14467748b343..848b23764fc3 100644
@@ -2068,7 +2068,7 @@ static ssize_t charge_threshold_store(struct device *dev,
 		return -EINVAL;
 
 	ret = asus_wmi_set_devstate(ASUS_WMI_CHARGE_THRESHOLD, value, &rv);
-	if (!ret)
+	if (ret)
 		return ret;
 
 	if (rv != 1)
Signature · 1 line
2.20.1
#1 lore raw
Quoted 3 lines · Dan Carpenter

This error handling is reversed so we return early.

I will squash to the original commit since it's not yet upstream.

Are you okay with this?

Quoted 22 lines
Fixes 84d8e80b0a36 ("platform/x86: asus-wmi: Refactor charge_threshold_store()")
---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +1 -2
index 14467748b343..848b23764fc3 100644
@@ -2068,7 +2068,7 @@ static ssize_t charge_threshold_store(struct device *dev,
                return -EINVAL;
 
        ret = asus_wmi_set_devstate(ASUS_WMI_CHARGE_THRESHOLD, value, &rv);
-       if (!ret)
+       if (ret)
                return ret;
 
        if (rv != 1)
--

2.20.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
In reply to Dan Carpenter
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Dan Carpenter

This error handling is reversed so we return early.

I will squash to the original commit since it's not yet upstream.

Are you okay with this?

Sure. That's fine.

regards,
dan carpenter