Skip to content

Commit

Permalink
platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill()
Browse files Browse the repository at this point in the history
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: d6f15ed ("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>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Markus Elfring authored and Andy Shevchenko committed Nov 5, 2017
1 parent 9d64fc0 commit f6c8a31
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/platform/x86/sony-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit f6c8a31

Please sign in to comment.