X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH] platform/x86: adv_swbutton: disable wakeup in .remove() and the error path of .probe()
@ 2024-12-06  9:48 Joe Hattori
  2024-12-10 13:52 ` Ilpo Järvinen
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Hattori @ 2024-12-06  9:48 UTC (permalink / raw)
  To: Andrea.Ho, hdegoede, ilpo.jarvinen; +Cc: platform-driver-x86, Joe Hattori

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);
 }
 
 static const struct acpi_device_id button_device_ids[] = {
-- 
2.34.1


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

end of thread, other threads:[~2024-12-11  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-12-11  9:01   ` Joe Hattori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox