From: SF Markus Elfring <elfring@users.sourceforge.net>
To: platform-driver-x86@vger.kernel.org,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Darren Hart <dvhart@infradead.org>,
Marco Chiappero <marco@absence.it>,
Matthew Garrett <mjg@redhat.com>,
Mattia Dongili <malattia@linux.it>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Andy Shevchenko <andy@infradead.org>
Subject: [PATCH v2 1/3] Sony-laptop: Fix exception handling in sony_nc_setup_rfkill()
Date: Wed, 1 Nov 2017 19:46:45 +0100 [thread overview]
Message-ID: <354baacc-58dd-7012-de2c-11042604826e@users.sourceforge.net> (raw)
In-Reply-To: <17ee534c-9fe6-19c4-0522-76cd3cbe5f88@users.sourceforge.net>
From: Markus Elfring <elfring@users.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.
Fixes: d6f15ed876b83a1a0eba1d0473eef58acc95444a ("sony-laptop: use soft rfkill status stored in hw")
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lkml.org/lkml/2017/10/31/463
Link: https://lkml.kernel.org/r/<CAHp75VcMkXCioCzmLE0+BTmkqc5RSOx9yPO0ectVHMrMvewgwg@mail.gmail.com>
Signed-off-by: Markus Elfring <elfring@users.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
next prev parent reply other threads:[~2017-11-01 18:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-30 20:15 [PATCH] Sony-laptop: Use common error handling code in sony_nc_setup_rfkill() SF Markus Elfring
2017-10-31 13:33 ` Andy Shevchenko
2017-10-31 14:24 ` SF Markus Elfring
2017-10-31 16:35 ` Andy Shevchenko
2017-10-31 16:56 ` SF Markus Elfring
2017-11-01 18:45 ` [PATCH v2 0/3] Sony-laptop: Adjustments for sony_nc_setup_rfkill() SF Markus Elfring
2017-11-01 18:46 ` SF Markus Elfring [this message]
2017-11-03 12:00 ` [PATCH v2 1/3] Sony-laptop: Fix exception handling in sony_nc_setup_rfkill() Andy Shevchenko
2017-11-01 18:47 ` [PATCH v2 2/3] Sony-laptop: Delete an unnecessary variable initialisation " SF Markus Elfring
2017-11-03 12:00 ` Andy Shevchenko
2017-11-01 18:49 ` [PATCH v2 3/3] Sony-laptop: Use common error handling code " SF Markus Elfring
2017-11-03 12:02 ` [PATCH v2 0/3] Sony-laptop: Adjustments for sony_nc_setup_rfkill() Andy Shevchenko
2017-11-03 13:23 ` SF Markus Elfring
2017-11-05 13:24 ` Andy Shevchenko
2017-11-05 14:20 ` SF Markus Elfring
2017-11-07 12:49 ` Andy Shevchenko
2017-11-07 13:00 ` SF Markus Elfring
2017-11-07 13:18 ` Andy Shevchenko
2017-11-07 13:54 ` SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=354baacc-58dd-7012-de2c-11042604826e@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=andy.shevchenko@gmail.com \
--cc=andy@infradead.org \
--cc=dvhart@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=malattia@linux.it \
--cc=marco@absence.it \
--cc=mjg@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).