From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Hongyan Xu <getshell@seu.edu.cn>
Cc: James Schulman <james.schulman@cirrus.com>,
David Rhodes <david.rhodes@cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>,
Lee Jones <lee@kernel.org>,
alsa-devel@alsa-project.org, patches@opensource.cirrus.com,
linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn
Subject: Re: [PATCH] mfd: cs42l43: cancel boot work during remove
Date: Thu, 30 Jul 2026 09:40:18 +0100 [thread overview]
Message-ID: <amsN8vJB+96MI6b+@opensource.cirrus.com> (raw)
In-Reply-To: <20260728065556.1508-1-getshell@seu.edu.cn>
On Tue, Jul 28, 2026 at 02:55:56PM +0800, Hongyan Xu wrote:
> Probe queues boot_work on system_long_wq, but both transport remove
> callbacks release the devm-allocated CS42L43 data without waiting for it.
>
> Cancel the work before powering the device down. Balance the runtime-PM
> reference when pending work is cancelled, and have the worker call the
> power-down helper directly on error to avoid cancelling itself.
>
> This issue was found by a static analysis tool.
>
> Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
> ---
> drivers/mfd/cs42l43.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/cs42l43.c b/drivers/mfd/cs42l43.c
> index 7b6d07c..411566e 100644
> --- a/drivers/mfd/cs42l43.c
> +++ b/drivers/mfd/cs42l43.c
> @@ -868,6 +868,8 @@ static int cs42l43_irq_config(struct cs42l43 *cs42l43)
> return 0;
> }
>
> +static int cs42l43_power_down(struct cs42l43 *cs42l43);
> +
> static void cs42l43_boot_work(struct work_struct *work)
> {
> struct cs42l43 *cs42l43 = container_of(work, struct cs42l43, boot_work);
> @@ -937,7 +939,7 @@ static void cs42l43_boot_work(struct work_struct *work)
>
> err:
> pm_runtime_put_sync(cs42l43->dev);
> - cs42l43_dev_remove(cs42l43);
> + cs42l43_power_down(cs42l43);
> }
>
> static int cs42l43_power_up(struct cs42l43 *cs42l43)
> @@ -1069,6 +1071,8 @@ EXPORT_SYMBOL_NS_GPL(cs42l43_dev_probe, MFD_CS42L43);
>
> void cs42l43_dev_remove(struct cs42l43 *cs42l43)
> {
> + if (cancel_work_sync(&cs42l43->boot_work))
> + pm_runtime_put_noidle(cs42l43->dev);
> cs42l43_power_down(cs42l43);
> }
This looks like it is based off a very old kernel, this was
already fixed back in October 2024. Please make sure to rebase
your submissions on ideally the maintainers tree, but at a
minimum Linus's tree.
Thanks,
Charles
prev parent reply other threads:[~2026-07-30 8:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 6:55 [PATCH] mfd: cs42l43: cancel boot work during remove Hongyan Xu
2026-07-30 8:40 ` Charles Keepax [this message]
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=amsN8vJB+96MI6b+@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=david.rhodes@cirrus.com \
--cc=getshell@seu.edu.cn \
--cc=james.schulman@cirrus.com \
--cc=jianhao.xu@seu.edu.cn \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=rf@opensource.cirrus.com \
/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