sony-laptop: Avoid oops on module unload for older laptops
authorLawrence Yiu <lawyiu.dev@gmail.com>
Mon, 21 Mar 2016 08:44:22 +0000 (01:44 -0700)
committerDarren Hart <dvhart@linux.intel.com>
Thu, 5 May 2016 23:32:32 +0000 (16:32 -0700)
Older VAIO laptops without the SN00 ACPI method will have the "handles"
variable unset. Return early from sony_nc_function_cleanup when "handles"
is null.

Signed-off-by: Lawrence Yiu <lawyiu.dev@gmail.com>
Acked-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
drivers/platform/x86/sony-laptop.c

index e9caa347a9bf3b174cb9b3aaaf0ecbea1dad16df..1dba3598cfcbdc531f1cdde7249974f0af0d3ef0 100644 (file)
@@ -1446,6 +1446,9 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
 {
        unsigned int i, result, bitmask, handle;
 
+       if (!handles)
+               return;
+
        /* get enabled events and disable them */
        sony_nc_int_call(sony_nc_acpi_handle, "SN01", NULL, &bitmask);
        sony_nc_int_call(sony_nc_acpi_handle, "SN03", &bitmask, &result);