From 9165d659e4a66ce01b785d2f645c5b36efb364cc Mon Sep 17 00:00:00 2001 From: Oleksandr Suvorov Date: Wed, 23 Dec 2020 14:05:24 +0200 Subject: sound: soc: fsl-spdif: Fix runtime PM imbalance on error In case of any error occurs after enabling the PM runtime framework for the fsl-spdif-dai device, the next probing generates the warning: "fsl-spdif-dai 2004000.spdif: Unbalanced pm_runtime_enable!" Add the error handling path to keep the PM runtime usage counter balanced. Signed-off-by: Oleksandr Suvorov --- sound/soc/fsl/fsl_spdif.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 93689892e97b..07f9ae81861c 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -1525,12 +1525,20 @@ static int fsl_spdif_probe(struct platform_device *pdev) &spdif_priv->cpu_dai_drv, 1); if (ret) { dev_err(&pdev->dev, "failed to register DAI: %d\n", ret); - return ret; + goto disable_pm_runtime; } ret = imx_pcm_dma_init(pdev, IMX_SPDIF_DMABUF_SIZE); - if (ret && ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret); + if (ret) { + if (ret != -EPROBE_DEFER) + dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret); + goto disable_pm_runtime; + } + + return 0; + +disable_pm_runtime: + pm_runtime_disable(&pdev->dev); return ret; } -- cgit v1.2.3