mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-07 06:14:24 +08:00
ASoC: mediatek: mt8183: Fix Unbalanced pm_runtime_enable in mt8183_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:a94aec035a122 ("ASoC: mediatek: mt8183: add platform driver") Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Link: https://lore.kernel.org/r/20210618141104.105047-3-zhangqilong3@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
2af2f861ed
commit
19f479c37f
@ -1119,25 +1119,26 @@ static int mt8183_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, &mt8183_afe_regmap_config);
|
ret = regmap_attach_dev(dev, afe->regmap, &mt8183_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
rstc = devm_reset_control_get(dev, "audiosys");
|
rstc = devm_reset_control_get(dev, "audiosys");
|
||||||
if (IS_ERR(rstc)) {
|
if (IS_ERR(rstc)) {
|
||||||
ret = PTR_ERR(rstc);
|
ret = PTR_ERR(rstc);
|
||||||
dev_err(dev, "could not get audiosys reset:%d\n", ret);
|
dev_err(dev, "could not get audiosys reset:%d\n", ret);
|
||||||
return ret;
|
goto err_pm_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = reset_control_reset(rstc);
|
ret = reset_control_reset(rstc);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "failed to trigger audio reset:%d\n", ret);
|
dev_err(dev, "failed to trigger audio reset:%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 */
|
||||||
@ -1147,7 +1148,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||||||
ret = regmap_reinit_cache(afe->regmap, &mt8183_afe_regmap_config);
|
ret = regmap_reinit_cache(afe->regmap, &mt8183_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);
|
||||||
@ -1160,8 +1161,10 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||||||
afe->memif_size = MT8183_MEMIF_NUM;
|
afe->memif_size = MT8183_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];
|
||||||
@ -1178,22 +1181,26 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||||||
afe->irqs_size = MT8183_IRQ_NUM;
|
afe->irqs_size = MT8183_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, mt8183_afe_irq_handler,
|
ret = devm_request_irq(dev, irq_id, mt8183_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 asys-isr\n");
|
dev_err(dev, "could not request_irq for asys-isr\n");
|
||||||
return ret;
|
goto err_pm_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init sub_dais */
|
/* init sub_dais */
|
||||||
@ -1204,7 +1211,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
dev_warn(afe->dev, "dai register i %d fail, ret %d\n",
|
dev_warn(afe->dev, "dai register i %d fail, ret %d\n",
|
||||||
i, ret);
|
i, ret);
|
||||||
return ret;
|
goto err_pm_disable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1213,7 +1220,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n",
|
dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n",
|
||||||
ret);
|
ret);
|
||||||
return ret;
|
goto err_pm_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
afe->mtk_afe_hardware = &mt8183_afe_hardware;
|
afe->mtk_afe_hardware = &mt8183_afe_hardware;
|
||||||
@ -1229,7 +1236,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||||||
NULL, 0);
|
NULL, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_warn(dev, "err_platform\n");
|
dev_warn(dev, "err_platform\n");
|
||||||
return ret;
|
goto err_pm_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = devm_snd_soc_register_component(afe->dev,
|
ret = devm_snd_soc_register_component(afe->dev,
|
||||||
@ -1238,10 +1245,14 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||||||
afe->num_dai_drivers);
|
afe->num_dai_drivers);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_warn(dev, "err_dai_component\n");
|
dev_warn(dev, "err_dai_component\n");
|
||||||
return ret;
|
goto err_pm_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
err_pm_disable:
|
||||||
|
pm_runtime_disable(&pdev->dev);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mt8183_afe_pcm_dev_remove(struct platform_device *pdev)
|
static int mt8183_afe_pcm_dev_remove(struct platform_device *pdev)
|
||||||
|
Loading…
Reference in New Issue
Block a user