Skip to content

Commit f0334fb

Browse files
CassivsGabriellisbroonie
authored andcommitted
ASoC: mediatek: mt8183: Check runtime resume during probe
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: a94aec0 ("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>
1 parent bee65e0 commit f0334fb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

sound/soc/mediatek/mt8183/mt8183-afe-pcm.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -844,17 +844,21 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
844844

845845
/* enable clock for regcache get default value from hw */
846846
afe_priv->pm_runtime_bypass_reg_ctl = true;
847-
pm_runtime_get_sync(dev);
848-
849-
ret = regmap_reinit_cache(afe->regmap, &mt8183_afe_regmap_config);
847+
ret = pm_runtime_resume_and_get(dev);
850848
if (ret) {
851-
dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret);
849+
afe_priv->pm_runtime_bypass_reg_ctl = false;
852850
goto err_pm_disable;
853851
}
854852

853+
ret = regmap_reinit_cache(afe->regmap, &mt8183_afe_regmap_config);
855854
pm_runtime_put_sync(dev);
856855
afe_priv->pm_runtime_bypass_reg_ctl = false;
857856

857+
if (ret) {
858+
dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret);
859+
goto err_pm_disable;
860+
}
861+
858862
regcache_cache_only(afe->regmap, true);
859863
regcache_mark_dirty(afe->regmap);
860864

0 commit comments

Comments
 (0)