Commit 2af2f861 authored by Zhang Qilong's avatar Zhang Qilong Committed by Mark Brown

ASoC: mediatek: mt8192:Fix Unbalanced pm_runtime_enable in mt8192_afe_pcm_dev_probe

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

Fixes:125ab5d5 ("ASoC: mediatek: mt8192: add platform driver")
Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20210618141104.105047-2-zhangqilong3@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 999abd7a
...@@ -2229,12 +2229,13 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -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); afe->regmap = syscon_node_to_regmap(dev->parent->of_node);
if (IS_ERR(afe->regmap)) { if (IS_ERR(afe->regmap)) {
dev_err(dev, "could not get regmap from parent\n"); 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); ret = regmap_attach_dev(dev, afe->regmap, &mt8192_afe_regmap_config);
if (ret) { if (ret) {
dev_warn(dev, "regmap_attach_dev fail, ret %d\n", 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 */ /* enable clock for regcache get default value from hw */
...@@ -2244,7 +2245,7 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -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); ret = regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config);
if (ret) { if (ret) {
dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret); dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret);
return ret; goto err_pm_disable;
} }
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
...@@ -2257,8 +2258,10 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -2257,8 +2258,10 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
afe->memif_size = MT8192_MEMIF_NUM; afe->memif_size = MT8192_MEMIF_NUM;
afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), afe->memif = devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif),
GFP_KERNEL); GFP_KERNEL);
if (!afe->memif) if (!afe->memif) {
return -ENOMEM; ret = -ENOMEM;
goto err_pm_disable;
}
for (i = 0; i < afe->memif_size; i++) { for (i = 0; i < afe->memif_size; i++) {
afe->memif[i].data = &memif_data[i]; afe->memif[i].data = &memif_data[i];
...@@ -2272,22 +2275,26 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -2272,22 +2275,26 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
afe->irqs_size = MT8192_IRQ_NUM; afe->irqs_size = MT8192_IRQ_NUM;
afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs),
GFP_KERNEL); GFP_KERNEL);
if (!afe->irqs) if (!afe->irqs) {
return -ENOMEM; ret = -ENOMEM;
goto err_pm_disable;
}
for (i = 0; i < afe->irqs_size; i++) for (i = 0; i < afe->irqs_size; i++)
afe->irqs[i].irq_data = &irq_data[i]; afe->irqs[i].irq_data = &irq_data[i];
/* request irq */ /* request irq */
irq_id = platform_get_irq(pdev, 0); irq_id = platform_get_irq(pdev, 0);
if (irq_id < 0) if (irq_id < 0) {
return irq_id; ret = irq_id;
goto err_pm_disable;
}
ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler, ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler,
IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); IRQF_TRIGGER_NONE, "asys-isr", (void *)afe);
if (ret) { if (ret) {
dev_err(dev, "could not request_irq for Afe_ISR_Handle\n"); dev_err(dev, "could not request_irq for Afe_ISR_Handle\n");
return ret; goto err_pm_disable;
} }
/* init sub_dais */ /* init sub_dais */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment