summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-generic-dmaengine-pcm.c
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@nxp.com>2018-02-22 16:02:21 -0300
committerMark Brown <broonie@kernel.org>2018-02-26 11:05:11 +0000
commitf91b1e73ccde71d4bc69ae10d475196df38844ab (patch)
tree6f4c7d71e95698c8406d2aea95c7d0bd7944e710 /sound/soc/soc-generic-dmaengine-pcm.c
parent4e3630101261f6ef8bf7ae171ace957d5753d093 (diff)
downloadlinux-stable-f91b1e73ccde71d4bc69ae10d475196df38844ab.tar.gz
linux-stable-f91b1e73ccde71d4bc69ae10d475196df38844ab.tar.bz2
linux-stable-f91b1e73ccde71d4bc69ae10d475196df38844ab.zip
ASoC: soc-generic-dmaengine-pcm: Fix error handling
When dmaengine_pcm_request_chan_of() fails it should release the previously acquired resources, which in this case is to call kfree(pcm), so jump to the correct point in the error path. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-generic-dmaengine-pcm.c')
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 768247fd92c5..32ea16d062b1 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -450,7 +450,7 @@ int snd_dmaengine_pcm_register(struct device *dev,
ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
if (ret)
- goto err_free_dma;
+ goto err_free_pcm;
ret = snd_soc_add_component(dev, &pcm->component,
&dmaengine_pcm_component, NULL, 0);
@@ -461,6 +461,7 @@ int snd_dmaengine_pcm_register(struct device *dev,
err_free_dma:
dmaengine_pcm_release_chan(pcm);
+err_free_pcm:
kfree(pcm);
return ret;
}