Skip to content

Commit

Permalink
ASoC: mediatek: mt8192:Fix Unbalanced pm_runtime_enable in mt8192_afe…
Browse files Browse the repository at this point in the history
…_pcm_dev_probe

[ Upstream commit 2af2f86 ]

Add missing pm_runtime_disable() when probe error out. It could
avoid pm_runtime implementation complains when removing and probing
again the driver.

Fixes:125ab5d588b0b ("ASoC: mediatek: mt8192: add platform driver")

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20210618141104.105047-2-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zhang Qilong authored and gregkh committed Sep 15, 2021
1 parent da307e9 commit 2b09ae7
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
Expand Up @@ -2229,12 +2229,13 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
afe->regmap = syscon_node_to_regmap(dev->parent->of_node);
if (IS_ERR(afe->regmap)) {
dev_err(dev, "could not get regmap from parent\n");
return PTR_ERR(afe->regmap);
ret = PTR_ERR(afe->regmap);
goto err_pm_disable;
}
ret = regmap_attach_dev(dev, afe->regmap, &mt8192_afe_regmap_config);
if (ret) {
dev_warn(dev, "regmap_attach_dev fail, ret %d\n", ret);
return ret;
goto err_pm_disable;
}

/* enable clock for regcache get default value from hw */
Expand All @@ -2244,7 +2245,7 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
ret = regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config);
if (ret) {
dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret);
return ret;
goto err_pm_disable;
}

pm_runtime_put_sync(&pdev->dev);
Expand All @@ -2257,8 +2258,10 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
afe->memif_size = MT8192_MEMIF_NUM;
afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif),
GFP_KERNEL);
if (!afe->memif)
return -ENOMEM;
if (!afe->memif) {
ret = -ENOMEM;
goto err_pm_disable;
}

for (i = 0; i < afe->memif_size; i++) {
afe->memif[i].data = &memif_data[i];
Expand All @@ -2272,22 +2275,26 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
afe->irqs_size = MT8192_IRQ_NUM;
afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs),
GFP_KERNEL);
if (!afe->irqs)
return -ENOMEM;
if (!afe->irqs) {
ret = -ENOMEM;
goto err_pm_disable;
}

for (i = 0; i < afe->irqs_size; i++)
afe->irqs[i].irq_data = &irq_data[i];

/* request irq */
irq_id = platform_get_irq(pdev, 0);
if (irq_id < 0)
return irq_id;
if (irq_id < 0) {
ret = irq_id;
goto err_pm_disable;
}

ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler,
IRQF_TRIGGER_NONE, "asys-isr", (void *)afe);
if (ret) {
dev_err(dev, "could not request_irq for Afe_ISR_Handle\n");
return ret;
goto err_pm_disable;
}

/* init sub_dais */
Expand Down

0 comments on commit 2b09ae7

Please sign in to comment.