From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Griffin Kroah-Hartman <griffin.kroah@fairphone.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 04/10] Input: aw86927 - use devm_work_autocancel() for haptics play work
Date: Fri, 27 Nov 2026 20:09:58 +0000 [thread overview]
Message-ID: <20261127201050.3532488-5-lee@kernel.org> (raw)
In-Reply-To: <20261127201050.3532488-1-lee@kernel.org>
aw86927_probe() initialises haptics->play_work with INIT_WORK() and
relies solely on aw86927_close() to cancel it. When the input device is
inhibited at unbind time, input_unregister_device() skips
aw86927_close() while evdev flush can still schedule play_work, allowing
aw86927_haptics_play_work() to run after devres frees haptics.
Use devm_work_autocancel() before registering the input device so devres
cancels play_work after input_unregister_device() and before freeing
driver resources.
Fixes: 52e06d564ce6 ("Input: aw86927 - add driver for Awinic AW86927")
Closes: https://sashiko.dev/#/bug/linux-819bee30-4290-430a-b9a3-7dbb99d73505
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/input/misc/aw86927.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/input/misc/aw86927.c b/drivers/input/misc/aw86927.c
index 0657c52b4c79..2d6bfb57afe1 100644
--- a/drivers/input/misc/aw86927.c
+++ b/drivers/input/misc/aw86927.c
@@ -10,6 +10,7 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/delay.h>
+#include <linux/devm-helpers.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/input.h>
@@ -826,7 +827,10 @@ static int aw86927_probe(struct i2c_client *client)
if (err)
return dev_err_probe(haptics->dev, err, "Failed to request threaded irq\n");
- INIT_WORK(&haptics->play_work, aw86927_haptics_play_work);
+ err = devm_work_autocancel(haptics->dev, &haptics->play_work,
+ aw86927_haptics_play_work);
+ if (err)
+ return err;
haptics->input_dev->name = "aw86927-haptics";
haptics->input_dev->close = aw86927_close;
--
2.56.1.839.g22a8290db9-goog
next prev parent reply other threads:[~2026-11-27 20:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 20:09 [PATCH 00/10] Input: Fix OOB writes, UAFs, NULL derefs, and suspend work bugs (batch 2) Lee Jones
2026-11-27 20:09 ` [PATCH 01/10] Input: adi - prevent off-by-one write in adi_read_packet() Lee Jones
2026-11-27 20:09 ` [PATCH 02/10] Input: adi - validate axis and button counts in adi_id_decode() Lee Jones
2026-11-27 20:09 ` [PATCH 03/10] Input: xpad - cancel presence work on xpad360w_start_input() failure Lee Jones
2026-11-27 20:09 ` Lee Jones [this message]
2026-11-27 20:09 ` [PATCH 05/10] Input: stmfts - fix i2c_smbus_read_i2c_block_data() check in status sysfs Lee Jones
2026-11-27 20:35 ` David Heidelberg
2026-11-27 20:10 ` [PATCH 06/10] Input: xen-kbdfront - check info->ptr and info->kbd before dereferencing Lee Jones
2026-11-27 20:10 ` [PATCH 07/10] Input: drv2665 - disable haptics work across suspend and resume Lee Jones
2026-11-27 20:10 ` [PATCH 08/10] Input: drv2667 " Lee Jones
2026-11-27 20:10 ` [PATCH 09/10] Input: goodix_berlin_i2c - check i2c_get_match_data() for NULL Lee Jones
2026-11-27 20:10 ` [PATCH 10/10] Input: goodix_berlin_spi - validate ic_data and SPI max transfer size Lee Jones
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=20261127201050.3532488-5-lee@kernel.org \
--to=lee@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=griffin.kroah@fairphone.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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
all inboxes | Powered by JetHome®