aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/sony-laptop.c
diff options
context:
space:
mode:
authorMattia Dongili <malattia@linux.it>2012-05-19 09:35:52 -0400
committerMatthew Garrett <mjg@redhat.com>2012-05-31 14:29:35 -0400
commitbab7084c745bf4d75b760728387f375fd34dc683 (patch)
tree689c46ff60c0799a58d85068d86cab5c39ed8a39 /drivers/platform/x86/sony-laptop.c
parent49f000adcad2d47f22ae97eb78fb2ef8081cd08f (diff)
sony-laptop: adjust error handling in finding SNC handles
All handles must be greater than 0, also return more meaningful error codes on invalid conditions. Signed-off-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/sony-laptop.c')
-rw-r--r--drivers/platform/x86/sony-laptop.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index c3f54ad8125c..2b72e476dfff 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -870,8 +870,8 @@ static int sony_find_snc_handle(int handle)
870 int i; 870 int i;
871 871
872 /* not initialized yet, return early */ 872 /* not initialized yet, return early */
873 if (!handles) 873 if (!handles || !handle)
874 return -1; 874 return -EINVAL;
875 875
876 for (i = 0; i < 0x10; i++) { 876 for (i = 0; i < 0x10; i++) {
877 if (handles->cap[i] == handle) { 877 if (handles->cap[i] == handle) {
@@ -881,7 +881,7 @@ static int sony_find_snc_handle(int handle)
881 } 881 }
882 } 882 }
883 dprintk("handle 0x%.4x not found\n", handle); 883 dprintk("handle 0x%.4x not found\n", handle);
884 return -1; 884 return -EINVAL;
885} 885}
886 886
887static int sony_call_snc_handle(int handle, int argument, int *result) 887static int sony_call_snc_handle(int handle, int argument, int *result)
@@ -890,7 +890,7 @@ static int sony_call_snc_handle(int handle, int argument, int *result)
890 int offset = sony_find_snc_handle(handle); 890 int offset = sony_find_snc_handle(handle);
891 891
892 if (offset < 0) 892 if (offset < 0)
893 return -1; 893 return offset;
894 894
895 arg = offset | argument; 895 arg = offset | argument;
896 ret = sony_nc_int_call(sony_nc_acpi_handle, "SN07", &arg, result); 896 ret = sony_nc_int_call(sony_nc_acpi_handle, "SN07", &arg, result);