All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hongyan Xu <getshell@seu.edu.cn>
To: cw00.choi@samsung.com, krzk@kernel.org, myungjoo.ham@samsung.com
Cc: jianhao.xu@seu.edu.cn, linux-kernel@vger.kernel.org,
	Hongyan Xu <getshell@seu.edu.cn>,
	stable@vger.kernel.org
Subject: [PATCH] extcon: max77693: cancel cable detection work on detach
Date: Tue, 28 Jul 2026 15:53:56 +0800	[thread overview]
Message-ID: <20260728075356.426-1-getshell@seu.edu.cn> (raw)

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

                 reply	other threads:[~2026-07-28  7:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260728075356.426-1-getshell@seu.edu.cn \
    --to=getshell@seu.edu.cn \
    --cc=cw00.choi@samsung.com \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --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 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.