From: sashiko-bot@kernel.org
To: "Elkin Cruz" <elkin@google.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 2/2] ASoC: mediatek: mt8189: clear afe->regmap on devm_regmap_init_mmio() error
Date: Fri, 20 Nov 2026 19:42:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-225947@kernel.org> (raw)
In-Reply-To: <20261120192237.2870582-3-elkin@google.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] ASoC: mediatek: mt8189: clock disable underflow in
mt8189_afe_pcm_dev_remove() [1]
--
commit d8496ec5beb278c4f15ca503ecbd50eb2598abc9
Author: Elkin Cruz <elkin@google.com>
ASoC: mediatek: mt8189: clear afe->regmap on devm_regmap_init_mmio() error
This commit clears afe->regmap to NULL when devm_regmap_init_mmio() fails
in mt8189_afe_pcm_dev_probe() so that mt8189_afe_runtime_suspend() does
not pass an ERR_PTR() to regmap functions during error unwinding.
> diff --git a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
> index f39b01590f714..85b5be6d45ec6 100644
> --- a/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
> +++ b/sound/soc/mediatek/mt8189/mt8189-afe-pcm.c
> @@ -2563,6 +2563,7 @@ static int mt8189_afe_pcm_dev_probe(struct platform_device *pdev)
> &mt8189_afe_regmap_config);
> if (IS_ERR(afe->regmap)) {
> ret = PTR_ERR(afe->regmap);
> + afe->regmap = NULL;
> goto err_pm_put;
> }
[Severity: High]
This problem wasn't introduced by this patch, but does
mt8189_afe_pcm_dev_remove() [1] underflow the clock enable counts by
disabling the AFE main and register read/write clocks after
mt8189_afe_runtime_suspend()?
sound/soc/mediatek/mt8189/mt8189-afe-pcm.c:mt8189_afe_pcm_dev_remove() {
...
if (!pm_runtime_status_suspended(dev))
mt8189_afe_runtime_suspend(dev);
mt8189_afe_disable_main_clock(afe);
/* disable afe clock */
mt8189_afe_disable_reg_rw_clk(afe);
}
mt8189_afe_runtime_suspend() already calls mt8189_afe_disable_main_clock()
and mt8189_afe_disable_reg_rw_clk(). Unconditionally disabling both
clocks a second time on device unbind corrupts the Common Clock Framework
reference counts and can shut down shared parent clocks still in use by
other peripherals.
[1] https://sashiko.dev/#/bug/linux-7209342b-8b8a-4947-a765-7c521cb675e9
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120192237.2870582-1-elkin@google.com?part=2
prev parent reply other threads:[~2026-11-20 19:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 19:22 [PATCH 0/2] ASoC: mediatek: clear afe->regmap on devm_regmap_init_mmio() error Elkin Cruz
2026-11-20 19:22 ` [PATCH 1/2] ASoC: mediatek: mt8196: " Elkin Cruz
2026-11-20 19:22 ` [PATCH 2/2] ASoC: mediatek: mt8189: " Elkin Cruz
2026-11-20 19:42 ` sashiko-bot [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=sashiko-outbox-225947@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=elkin@google.com \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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