Skip to contentSkip to conversation

ASoC: Revert "ASoC: soc-generic-dmaengine-pcm: Fix error handling"

PATCH New Fabio Estevam 1 participant 1 message Feb 26, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Revert "ASoC: soc-generic-dmaengine-pcm: Fix error handling"

From: Fabio Estevam <[email protected]>

This reverts commit f91b1e73ccde71d4bc69ae10d475196df38844ab.

As explained by Lars-Peter Clausen:

"This creates a resource leak. dmaengine_pcm_request_chan_of() requests bothtransmit and receive channels. It might return with an error if one of them fails, but the other one succeeded. In this case we need to call dmaengine_pcm_release_chan() to free the requested channel"

So revert the commit.

---
 sound/soc/soc-generic-dmaengine-pcm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/soc-generic-dmaengine-pcm.c +1 -2
index 32ea16d..768247f 100644
@@ -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_pcm;
+		goto err_free_dma;
 
 	ret = snd_soc_add_component(dev, &pcm->component,
 				    &dmaengine_pcm_component, NULL, 0);
@@ -461,7 +461,6 @@ int snd_dmaengine_pcm_register(struct device *dev,
 
 err_free_dma:
 	dmaengine_pcm_release_chan(pcm);
-err_free_pcm:
 	kfree(pcm);
 	return ret;
 }
Signature · 1 line
2.7.4