summaryrefslogtreecommitdiff
path: root/sound/soc/pxa
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2020-05-20 11:35:16 +0300
committerMark Brown <broonie@kernel.org>2020-05-20 17:48:16 +0300
commit6ea460d52299f7febd408f2710d7c43ce505bc2c (patch)
tree007aa958d8508af0622de9d3caee268ad05b91d4 /sound/soc/pxa
parentd81bb8726c247c3e7719d21bf213c5400de29e03 (diff)
downloadlinux-6ea460d52299f7febd408f2710d7c43ce505bc2c.tar.xz
ASoC: mmp-sspa: Fix the error handling in probe()
If we fail after pm_runtime_enable(), we fail to undo it. Same with clk_prepare_enable(). Let's order them after all things that can fail. Fixes: 7d98cc648253 ("ASoC: mmp-sspa: Add support for the runtime power management") Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Link: https://lore.kernel.org/r/20200520083516.2120802-1-lkundrak@v3.sk Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r--sound/soc/pxa/mmp-sspa.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index b0accd49c89d..3e37ab625f8d 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -462,6 +462,7 @@ static const struct snd_soc_component_driver mmp_sspa_component = {
static int asoc_mmp_sspa_probe(struct platform_device *pdev)
{
struct sspa_priv *sspa;
+ int ret;
sspa = devm_kzalloc(&pdev->dev,
sizeof(struct sspa_priv), GFP_KERNEL);
@@ -514,8 +515,6 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev)
return PTR_ERR(sspa->sysclk);
}
}
- pm_runtime_enable(&pdev->dev);
- clk_prepare_enable(sspa->audio_clk);
platform_set_drvdata(pdev, sspa);
sspa->playback_dma_data.maxburst = 4;
@@ -525,16 +524,21 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev)
sspa->playback_dma_data.addr = 0x80 + SSPA_D;
if (pdev->dev.of_node) {
- int ret;
-
ret = devm_snd_dmaengine_pcm_register(&pdev->dev,
&mmp_pcm_config, 0);
if (ret)
return ret;
}
- return devm_snd_soc_register_component(&pdev->dev, &mmp_sspa_component,
- &mmp_sspa_dai, 1);
+ ret = devm_snd_soc_register_component(&pdev->dev, &mmp_sspa_component,
+ &mmp_sspa_dai, 1);
+ if (ret)
+ return ret;
+
+ pm_runtime_enable(&pdev->dev);
+ clk_prepare_enable(sspa->audio_clk);
+
+ return 0;
}
static int asoc_mmp_sspa_remove(struct platform_device *pdev)