diff mbox series

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

Message ID 20190902143850.GA607@mwanda (mailing list archive)
State Accepted, archived
Delegated to: Andy Shevchenko
Headers show
Series platform/x86: asus-wmi: Fix condition in charge_threshold_store() | expand

Commit Message

Dan Carpenter Sept. 2, 2019, 2:38 p.m. UTC
This error handling is reversed so we return early.

Fixes: 84d8e80b0a36 ("platform/x86: asus-wmi: Refactor charge_threshold_store()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko Sept. 2, 2019, 3:12 p.m. UTC | #1
On Mon, Sep 2, 2019 at 5:41 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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?

> Fixes: 84d8e80b0a36 ("platform/x86: asus-wmi: Refactor charge_threshold_store()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/platform/x86/asus-wmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 14467748b343..848b23764fc3 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -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
>
Dan Carpenter Sept. 2, 2019, 5:24 p.m. UTC | #2
On Mon, Sep 02, 2019 at 06:12:07PM +0300, Andy Shevchenko wrote:
> On Mon, Sep 2, 2019 at 5:41 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > 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
diff mbox series

Patch

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 14467748b343..848b23764fc3 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -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)