From: Lawrence Yiu Date: Mon, 21 Mar 2016 08:44:22 +0000 (-0700) Subject: sony-laptop: Avoid oops on module unload for older laptops X-Git-Tag: v4.7-rc1~30^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ddd9357f6017a8c61a20685feab5ce9eee635f6c;p=thirdparty%2Fkernel%2Flinux.git sony-laptop: Avoid oops on module unload for older laptops 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 Acked-by: Mattia Dongili Signed-off-by: Darren Hart --- diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index e9caa347a9bf3..1dba3598cfcbd 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -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);