mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
ASoC: mediatek: mt8183: Check runtime resume during probe
[ Upstream commitf0334fbfd1] The MT8183 AFE probe uses pm_runtime_get_sync() before reading hardware defaults into the regmap cache, but does not check whether runtime resume failed. If regmap_reinit_cache() then fails, the temporary runtime PM usage count is also not released. Use pm_runtime_resume_and_get() so resume failures abort probe without leaking a usage count, and release the temporary reference before handling the regmap cache result. Fixes:a94aec035a("ASoC: mediatek: mt8183: add platform driver") Cc: stable@vger.kernel.org Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com> Link: https://patch.msgid.link/20260527-asoc-mt8183-probe-cleanup-v1-2-4f4f5593c8d1@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6e2ee6eacc
commit
233f357bf4
@@ -1149,17 +1149,21 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
|
||||
|
||||
/* enable clock for regcache get default value from hw */
|
||||
afe_priv->pm_runtime_bypass_reg_ctl = true;
|
||||
pm_runtime_get_sync(&pdev->dev);
|
||||
ret = pm_runtime_resume_and_get(dev);
|
||||
if (ret) {
|
||||
afe_priv->pm_runtime_bypass_reg_ctl = false;
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = regmap_reinit_cache(afe->regmap, &mt8183_afe_regmap_config);
|
||||
pm_runtime_put_sync(dev);
|
||||
afe_priv->pm_runtime_bypass_reg_ctl = false;
|
||||
|
||||
if (ret) {
|
||||
dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret);
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
pm_runtime_put_sync(&pdev->dev);
|
||||
afe_priv->pm_runtime_bypass_reg_ctl = false;
|
||||
|
||||
regcache_cache_only(afe->regmap, true);
|
||||
regcache_mark_dirty(afe->regmap);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user