[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfxCqwimP7=VJjZR457kmb6bUu=NZOquf-YdPHSvOgt1w@mail.gmail.com>
Date: Fri, 3 Nov 2017 14:00:00 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: Platform Driver <platform-driver-x86@...r.kernel.org>,
Darren Hart <dvhart@...radead.org>,
Marco Chiappero <marco@...ence.it>,
Matthew Garrett <mjg@...hat.com>,
Mattia Dongili <malattia@...ux.it>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Andy Shevchenko <andy@...radead.org>
Subject: Re: [PATCH v2 1/3] Sony-laptop: Fix exception handling in sony_nc_setup_rfkill()
On Wed, Nov 1, 2017 at 8:46 PM, SF Markus Elfring
<elfring@...rs.sourceforge.net> wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Wed, 1 Nov 2017 18:42:45 +0100
>
> Source code review for a specific software refactoring showed the need
> for another correction because the error code "-1" was returned so far
> if a call of the function "sony_call_snc_handle" failed here.
> Thus assign the return value from these two function calls also to
> the variable "err" and provide it in case of a failure.
>
Applied to my review and testing queue, thanks!
> Fixes: d6f15ed876b83a1a0eba1d0473eef58acc95444a ("sony-laptop: use soft rfkill status stored in hw")
> Suggested-by: Andy Shevchenko <andy.shevchenko@...il.com>
> Link: https://lkml.org/lkml/2017/10/31/463
> Link: https://lkml.kernel.org/r/<CAHp75VcMkXCioCzmLE0+BTmkqc5RSOx9yPO0ectVHMrMvewgwg@...l.gmail.com>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
> drivers/platform/x86/sony-laptop.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index a16cea2be9c3..4332cc982ce0 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -1660,17 +1660,19 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
> if (!rfk)
> return -ENOMEM;
>
> - if (sony_call_snc_handle(sony_rfkill_handle, 0x200, &result) < 0) {
> + err = sony_call_snc_handle(sony_rfkill_handle, 0x200, &result);
> + if (err < 0) {
> rfkill_destroy(rfk);
> - return -1;
> + return err;
> }
> hwblock = !(result & 0x1);
>
> - if (sony_call_snc_handle(sony_rfkill_handle,
> - sony_rfkill_address[nc_type],
> - &result) < 0) {
> + err = sony_call_snc_handle(sony_rfkill_handle,
> + sony_rfkill_address[nc_type],
> + &result);
> + if (err < 0) {
> rfkill_destroy(rfk);
> - return -1;
> + return err;
> }
> swblock = !(result & 0x2);
>
> --
> 2.14.3
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists