All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sony-laptop: Avoid oops on module unload for older laptops
@ 2016-03-21  8:44 Lawrence Yiu
  2016-03-22 13:51 ` Mattia Dongili
  2016-05-05 23:22 ` Darren Hart
  0 siblings, 2 replies; 3+ messages in thread
From: Lawrence Yiu @ 2016-03-21  8:44 UTC (permalink / raw)
  To: platform-driver-x86; +Cc: malattia

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>
---
 drivers/platform/x86/sony-laptop.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index e9caa34..1dba359 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);
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sony-laptop: Avoid oops on module unload for older laptops
  2016-03-21  8:44 [PATCH] sony-laptop: Avoid oops on module unload for older laptops Lawrence Yiu
@ 2016-03-22 13:51 ` Mattia Dongili
  2016-05-05 23:22 ` Darren Hart
  1 sibling, 0 replies; 3+ messages in thread
From: Mattia Dongili @ 2016-03-22 13:51 UTC (permalink / raw)
  To: Lawrence Yiu; +Cc: platform-driver-x86

On Mon, Mar 21, 2016 at 01:44:22AM -0700, Lawrence Yiu wrote:
> 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>

> ---
>  drivers/platform/x86/sony-laptop.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index e9caa34..1dba359 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;
> +

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.
-- 
mattia
:wq!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sony-laptop: Avoid oops on module unload for older laptops
  2016-03-21  8:44 [PATCH] sony-laptop: Avoid oops on module unload for older laptops Lawrence Yiu
  2016-03-22 13:51 ` Mattia Dongili
@ 2016-05-05 23:22 ` Darren Hart
  1 sibling, 0 replies; 3+ messages in thread
From: Darren Hart @ 2016-05-05 23:22 UTC (permalink / raw)
  To: Lawrence Yiu; +Cc: platform-driver-x86, malattia

On Mon, Mar 21, 2016 at 01:44:22AM -0700, Lawrence Yiu wrote:
> 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.

> Signed-off-by: Lawrence Yiu <lawyiu.dev@gmail.com>
> ---
>  drivers/platform/x86/sony-laptop.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index e9caa34..1dba359 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;

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.

> +
>  	/* 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);
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-05 23:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-21  8:44 [PATCH] sony-laptop: Avoid oops on module unload for older laptops Lawrence Yiu
2016-03-22 13:51 ` Mattia Dongili
2016-05-05 23:22 ` Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.