Skip to content

Commit

Permalink
ASoC: fsl_rpmsg: Fix error handler with pm_runtime_enable
Browse files Browse the repository at this point in the history
[ Upstream commit f9d378f ]

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: b73d9e6 ("ASoC: fsl_rpmsg: Add CPU DAI driver for audio base on rpmsg")
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20231225080608.967953-1-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Chancel Liu authored and gregkh committed Jan 10, 2024
1 parent c3a37dc commit 811604f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sound/soc/fsl/fsl_rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static int fsl_rpmsg_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component,
&fsl_rpmsg_dai, 1);
if (ret)
return ret;
goto err_pm_disable;

rpmsg->card_pdev = platform_device_register_data(&pdev->dev,
"imx-audio-rpmsg",
Expand All @@ -241,16 +241,22 @@ static int fsl_rpmsg_probe(struct platform_device *pdev)
if (IS_ERR(rpmsg->card_pdev)) {
dev_err(&pdev->dev, "failed to register rpmsg card\n");
ret = PTR_ERR(rpmsg->card_pdev);
return ret;
goto err_pm_disable;
}

return 0;

err_pm_disable:
pm_runtime_disable(&pdev->dev);
return ret;
}

static int fsl_rpmsg_remove(struct platform_device *pdev)
{
struct fsl_rpmsg *rpmsg = platform_get_drvdata(pdev);

pm_runtime_disable(&pdev->dev);

if (rpmsg->card_pdev)
platform_device_unregister(rpmsg->card_pdev);

Expand Down

0 comments on commit 811604f

Please sign in to comment.