ASoC: fsl_xcvr:Fix unbalanced pm_runtime_enable in fsl_xcvr_probe

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

Fix:c590fa80b3928 ("ASoC: fsl_xcvr: register platform component before registering cpu dai")

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20220602072024.33236-1-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
zhangqilong 2022-06-02 15:20:24 +08:00 committed by Mark Brown
parent 84965cc60e
commit 9c3148dec7
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1228,6 +1228,7 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
*/
ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
if (ret) {
pm_runtime_disable(dev);
dev_err(dev, "failed to pcm register\n");
return ret;
}
@ -1235,6 +1236,7 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_component(dev, &fsl_xcvr_comp,
&fsl_xcvr_dai, 1);
if (ret) {
pm_runtime_disable(dev);
dev_err(dev, "failed to register component %s\n",
fsl_xcvr_comp.name);
}
@ -1242,6 +1244,12 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
return ret;
}
static int fsl_xcvr_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
return 0;
}
static __maybe_unused int fsl_xcvr_runtime_suspend(struct device *dev)
{
struct fsl_xcvr *xcvr = dev_get_drvdata(dev);
@ -1370,6 +1378,7 @@ static struct platform_driver fsl_xcvr_driver = {
.pm = &fsl_xcvr_pm_ops,
.of_match_table = fsl_xcvr_dt_ids,
},
.remove = fsl_xcvr_remove,
};
module_platform_driver(fsl_xcvr_driver);