diff mbox series

ASoC: fsl: Fix PM disable depth imbalance in fsl_easrc_probe

Message ID tencent_681B0528D436898B1B945A8B2D46300C0F07@qq.com (mailing list archive)
State Superseded
Headers show
Series ASoC: fsl: Fix PM disable depth imbalance in fsl_easrc_probe | expand

Commit Message

Zhang Shurong Oct. 4, 2023, 7:12 a.m. UTC
The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context. We fix it by calling
pm_runtime_disable when error returns.

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
 sound/soc/fsl/fsl_easrc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Shengjiu Wang Oct. 8, 2023, 9:37 a.m. UTC | #1
On Wed, Oct 4, 2023 at 3:12 PM Zhang Shurong <zhang_shurong@foxmail.com> wrote:
>
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context. We fix it by calling
> pm_runtime_disable when error returns.
>

Please add a Fixes tag.
Thanks.

Best regards
Wang Shengjiu

> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
> ---
>  sound/soc/fsl/fsl_easrc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
> index ba62995c909a..ec53bda46a46 100644
> --- a/sound/soc/fsl/fsl_easrc.c
> +++ b/sound/soc/fsl/fsl_easrc.c
> @@ -1966,17 +1966,21 @@ static int fsl_easrc_probe(struct platform_device *pdev)
>                                               &fsl_easrc_dai, 1);
>         if (ret) {
>                 dev_err(dev, "failed to register ASoC DAI\n");
> -               return ret;
> +               goto err_pm_disable;
>         }
>
>         ret = devm_snd_soc_register_component(dev, &fsl_asrc_component,
>                                               NULL, 0);
>         if (ret) {
>                 dev_err(&pdev->dev, "failed to register ASoC platform\n");
> -               return ret;
> +               goto err_pm_disable;
>         }
>
>         return 0;
> +
> +err_pm_disable:
> +       pm_runtime_disable(&pdev->dev);
> +       return ret;
>  }
>
>  static void fsl_easrc_remove(struct platform_device *pdev)
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index ba62995c909a..ec53bda46a46 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1966,17 +1966,21 @@  static int fsl_easrc_probe(struct platform_device *pdev)
 					      &fsl_easrc_dai, 1);
 	if (ret) {
 		dev_err(dev, "failed to register ASoC DAI\n");
-		return ret;
+		goto err_pm_disable;
 	}
 
 	ret = devm_snd_soc_register_component(dev, &fsl_asrc_component,
 					      NULL, 0);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register ASoC platform\n");
-		return ret;
+		goto err_pm_disable;
 	}
 
 	return 0;
+
+err_pm_disable:
+	pm_runtime_disable(&pdev->dev);
+	return ret;
 }
 
 static void fsl_easrc_remove(struct platform_device *pdev)