Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626457

Re: [PATCH 1/2] hp-wmi: Fix error value for hp_wmi_tablet_state

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] hp-wmi: Fix error value for hp_wmi_tablet_state
Date 2017-04-19 18:30 +0200
Message-ID <ty0Eq-5Fr-15@gated-at.bofh.it> (permalink)
References <tulxM-3uX-9@gated-at.bofh.it> <tulxM-3uX-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Apr 9, 2017 at 4:56 PM, Carlo Caione <carlo@caione.org> wrote:
> From: Carlo Caione <carlo@endlessm.com>
>
> hp_wmi_tablet_state() fails to return the correct error code when
> hp_wmi_perform_query() returns the HP WMI query specific error code
> that is a positive value.

>         int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, &state,
>                                        sizeof(state), sizeof(state));
>         if (ret)
> -               return ret;
> +               return -EINVAL;

Shouldn't be something like

if (ret)
 return ret < 0 ? ret : -EINVAL;

Looking into the code it looks like it may return all possible values:
0, negative, positive.

-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/2] hp-wmi: Fix error value for hp_wmi_tablet_state Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-19 18:30 +0200
  Re: [PATCH 1/2] hp-wmi: Fix error value for hp_wmi_tablet_state Carlo Caione <carlo@endlessm.com> - 2017-04-19 18:30 +0200
    Re: [PATCH 1/2] hp-wmi: Fix error value for hp_wmi_tablet_state Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-19 18:30 +0200

csiph-web