]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ASoC: soc-generic-dmaengine-pcm: Fix error handling
authorFabio Estevam <fabio.estevam@nxp.com>
Thu, 22 Feb 2018 19:02:21 +0000 (16:02 -0300)
committerMark Brown <broonie@kernel.org>
Mon, 26 Feb 2018 11:05:11 +0000 (11:05 +0000)
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>
sound/soc/soc-generic-dmaengine-pcm.c

index 768247fd92c535864887657b480b8044c32a4d1d..32ea16d062b177ea9be297ba2cd84517bef54174 100644 (file)
@@ -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;
 }