Skip to contentSkip to conversation

sony-laptop: Avoid oops on module unload for older laptops

PATCH In review Lawrence Yiu 3 participants 3 messages Mar 21, 2016 – May 5, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/platform/x86/sony-laptop.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/platform/x86/sony-laptop.c +3 -0
index e9caa34..1dba359 100644
@@ -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);
Signature · 1 line
2.5.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Lawrence Yiu

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.

Quoted 9 lines
---
 drivers/platform/x86/sony-laptop.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/platform/x86/sony-laptop.c +0 -0
index e9caa34..1dba359 100644

drivers/platform/x86/sony-laptop.c static void sony_nc_function_cleanup(struct platform_device *pd) · line 1451

Quoted 6 lines
drivers/platform/x86/sony-laptop.c +3 -0
@@ -1446,6 +1446,9 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
 {
 	unsigned int i, result, bitmask, handle;
 
+	if (!handles)
+		return;
+

Thank you, this is indeed necessary.

Given how long this sat around, it may be a good time to start cleaning-up some legacy models support. Later anyway.

Signature · 2 lines
mattia
:wq!
#2 lore raw
In reply to Lawrence Yiu
Quoted 4 lines · Lawrence Yiu

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.

Hi Lawrence,

Please include all maintainers listed by get_maintainer.pl. My scripts collect those that apply to the tree where I'm not Cc'd, but the ones that land in the Inbox take priority.

Quoted 10 lines
---
 drivers/platform/x86/sony-laptop.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/platform/x86/sony-laptop.c +0 -0
index e9caa34..1dba359 100644

drivers/platform/x86/sony-laptop.c static void sony_nc_function_cleanup(struct platform_device *pd) · line 1450

Quoted 5 lines
drivers/platform/x86/sony-laptop.c +2 -0
@@ -1446,6 +1446,9 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
 {
 	unsigned int i, result, bitmask, handle;
 
+	if (!handles)
+		return;

Hrm... the cleanup logic in this driver definitely has something to be desired. sony_nc_handles_cleanup is called at the end of this function, and it checks for handles != NULL.... and this is called from too many places.

So, this driver needs some cleanup - but I'm taking this patch as is for an immediately "fix". Thank you for submitting.

Quoted 12 lines
drivers/platform/x86/sony-laptop.c +1 -0
+
 	/* 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);
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center