Commit f91b1e73 authored by Fabio Estevam's avatar Fabio Estevam Committed by Mark Brown

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: default avatarFabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4e363010
...@@ -450,7 +450,7 @@ int snd_dmaengine_pcm_register(struct device *dev, ...@@ -450,7 +450,7 @@ int snd_dmaengine_pcm_register(struct device *dev,
ret = dmaengine_pcm_request_chan_of(pcm, dev, config); ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
if (ret) if (ret)
goto err_free_dma; goto err_free_pcm;
ret = snd_soc_add_component(dev, &pcm->component, ret = snd_soc_add_component(dev, &pcm->component,
&dmaengine_pcm_component, NULL, 0); &dmaengine_pcm_component, NULL, 0);
...@@ -461,6 +461,7 @@ int snd_dmaengine_pcm_register(struct device *dev, ...@@ -461,6 +461,7 @@ int snd_dmaengine_pcm_register(struct device *dev,
err_free_dma: err_free_dma:
dmaengine_pcm_release_chan(pcm); dmaengine_pcm_release_chan(pcm);
err_free_pcm:
kfree(pcm); kfree(pcm);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment