Commit f9d378fc authored by Chancel Liu's avatar Chancel Liu Committed by Mark Brown

ASoC: fsl_rpmsg: Fix error handler with pm_runtime_enable

There is error message when defer probe happens:

fsl_rpmsg rpmsg_audio: Unbalanced pm_runtime_enable!

Fix the error handler with pm_runtime_enable.

Fixes: b73d9e62 ("ASoC: fsl_rpmsg: Add CPU DAI driver for audio base on rpmsg")
Signed-off-by: default avatarChancel Liu <chancel.liu@nxp.com>
Acked-by: default avatarShengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20231225080608.967953-1-chancel.liu@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8f0f0164
...@@ -238,7 +238,7 @@ static int fsl_rpmsg_probe(struct platform_device *pdev) ...@@ -238,7 +238,7 @@ static int fsl_rpmsg_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component, ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component,
&fsl_rpmsg_dai, 1); &fsl_rpmsg_dai, 1);
if (ret) if (ret)
return ret; goto err_pm_disable;
rpmsg->card_pdev = platform_device_register_data(&pdev->dev, rpmsg->card_pdev = platform_device_register_data(&pdev->dev,
"imx-audio-rpmsg", "imx-audio-rpmsg",
...@@ -248,16 +248,22 @@ static int fsl_rpmsg_probe(struct platform_device *pdev) ...@@ -248,16 +248,22 @@ static int fsl_rpmsg_probe(struct platform_device *pdev)
if (IS_ERR(rpmsg->card_pdev)) { if (IS_ERR(rpmsg->card_pdev)) {
dev_err(&pdev->dev, "failed to register rpmsg card\n"); dev_err(&pdev->dev, "failed to register rpmsg card\n");
ret = PTR_ERR(rpmsg->card_pdev); ret = PTR_ERR(rpmsg->card_pdev);
return ret; goto err_pm_disable;
} }
return 0; return 0;
err_pm_disable:
pm_runtime_disable(&pdev->dev);
return ret;
} }
static void fsl_rpmsg_remove(struct platform_device *pdev) static void fsl_rpmsg_remove(struct platform_device *pdev)
{ {
struct fsl_rpmsg *rpmsg = platform_get_drvdata(pdev); struct fsl_rpmsg *rpmsg = platform_get_drvdata(pdev);
pm_runtime_disable(&pdev->dev);
if (rpmsg->card_pdev) if (rpmsg->card_pdev)
platform_device_unregister(rpmsg->card_pdev); platform_device_unregister(rpmsg->card_pdev);
} }
......
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