* [PATCH] extcon: max77693: cancel cable detection work on detach
@ 2026-07-28 7:53 Hongyan Xu
0 siblings, 0 replies; only message in thread
From: Hongyan Xu @ 2026-07-28 7:53 UTC (permalink / raw)
To: cw00.choi, krzk, myungjoo.ham
Cc: jianhao.xu, linux-kernel, Hongyan Xu, stable
max77693_muic_probe() queues wq_detcable after the MUIC has been
initialized. The delayed work uses the driver private data and device
resources, but the driver has no remove callback to cancel it. If the
device is detached before the delayed detection runs, the work can run
after the devm-managed data has started going away.
Initialize the delayed work with devm_delayed_work_autocancel() so the
work is synchronously cancelled during device teardown.
This issue was found by a static analysis tool.
Fixes: db1b9037424b ("extcon: MAX77693: Add extcon-max77693 driver to support Maxim MAX77693 MUIC device")
Cc: stable@vger.kernel.org
Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
---
drivers/extcon/extcon-max77693.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 2c567e0b7b7..2dee37faa09 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1251,7 +1251,11 @@ static int max77693_muic_probe(struct platform_device *pdev)
* After completing the booting of platform, the extcon provider
* driver should notify cable state to upper layer.
*/
- INIT_DELAYED_WORK(&info->wq_detcable, max77693_muic_detect_cable_wq);
+ ret = devm_delayed_work_autocancel(&pdev->dev, &info->wq_detcable,
+ max77693_muic_detect_cable_wq);
+ if (ret)
+ return ret;
+
queue_delayed_work(system_power_efficient_wq, &info->wq_detcable,
delay_jiffies);
--
2.50.1.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-28 7:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 7:53 [PATCH] extcon: max77693: cancel cable detection work on detach Hongyan Xu
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.