X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Cc: Andrea.Ho@advantech.com.tw, Hans de Goede <hdegoede@redhat.com>,
	 platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] platform/x86: adv_swbutton: disable wakeup in .remove() and the error path of .probe()
Date: Tue, 10 Dec 2024 15:52:23 +0200 (EET)	[thread overview]
Message-ID: <4e5fc1c6-ca8f-51a5-8ec4-5891166d8732@linux.intel.com> (raw)
In-Reply-To: <20241206094848.1650137-1-joe@pf.is.s.u-tokyo.ac.jp>

On Fri, 6 Dec 2024, Joe Hattori wrote:

> Current code leaves the device's wakeup enabled in the error path of
> .probe() and .remove(), which results in a memory leak. Therefore, add
> the device_init_wakeup(&device->dev, false) calls.
> 
> Fixes: 3d904005f686 ("platform/x86: add support for Advantech software defined button")
> Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
> ---
>  drivers/platform/x86/adv_swbutton.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/platform/x86/adv_swbutton.c b/drivers/platform/x86/adv_swbutton.c
> index 6fa60f3fc53c..523836be6d4b 100644
> --- a/drivers/platform/x86/adv_swbutton.c
> +++ b/drivers/platform/x86/adv_swbutton.c
> @@ -84,6 +84,7 @@ static int adv_swbutton_probe(struct platform_device *device)
>  					     device);
>  	if (ACPI_FAILURE(status)) {
>  		dev_err(&device->dev, "Error installing notify handler\n");
> +		device_init_wakeup(&device->dev, false);
>  		return -EIO;
>  	}
>  
> @@ -96,6 +97,7 @@ static void adv_swbutton_remove(struct platform_device *device)
>  
>  	acpi_remove_notify_handler(handle, ACPI_DEVICE_NOTIFY,
>  				   adv_swbutton_notify);
> +	device_init_wakeup(&device->dev, false);

Is the non-symmetric order here intentional?

How about using devm_add_action_or_reset() instead?

-- 
 i.


  reply	other threads:[~2024-12-10 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06  9:48 [PATCH] platform/x86: adv_swbutton: disable wakeup in .remove() and the error path of .probe() Joe Hattori
2024-12-10 13:52 ` Ilpo Järvinen [this message]
2024-12-11  9:01   ` Joe Hattori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e5fc1c6-ca8f-51a5-8ec4-5891166d8732@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Andrea.Ho@advantech.com.tw \
    --cc=hdegoede@redhat.com \
    --cc=joe@pf.is.s.u-tokyo.ac.jp \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox