dmaengine Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 2/2] dmaengine: ti: edma: fix missed failure handling
@ 2019-11-18  7:38 Chuhong Yuan
  2019-11-22  5:43 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-11-18  7:38 UTC (permalink / raw)
  To: unlisted-recipients:; (no To-header on input)
  Cc: Vinod Koul, Dan Williams, dmaengine, linux-kernel, Chuhong Yuan

When devm_kcalloc fails, it forgets to call edma_free_slot.
Replace direct return with failure handler to fix it.

Fixes: 1be5336bc7ba ("dmaengine: edma: New device tree binding")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/dma/ti/edma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
index 8be32fd9f762..79bc8503cf32 100644
--- a/drivers/dma/ti/edma.c
+++ b/drivers/dma/ti/edma.c
@@ -2413,8 +2413,10 @@ static int edma_probe(struct platform_device *pdev)
 
 		ecc->tc_list = devm_kcalloc(dev, ecc->num_tc,
 					    sizeof(*ecc->tc_list), GFP_KERNEL);
-		if (!ecc->tc_list)
-			return -ENOMEM;
+		if (!ecc->tc_list) {
+			ret = -ENOMEM;
+			goto err_reg1;
+		}
 
 		for (i = 0;; i++) {
 			ret = of_parse_phandle_with_fixed_args(node, "ti,tptcs",
-- 
2.24.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] dmaengine: ti: edma: fix missed failure handling
  2019-11-18  7:38 [PATCH 2/2] dmaengine: ti: edma: fix missed failure handling Chuhong Yuan
@ 2019-11-22  5:43 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2019-11-22  5:43 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: Dan Williams, dmaengine, linux-kernel

On 18-11-19, 15:38, Chuhong Yuan wrote:
> When devm_kcalloc fails, it forgets to call edma_free_slot.
> Replace direct return with failure handler to fix it.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18  7:38 [PATCH 2/2] dmaengine: ti: edma: fix missed failure handling Chuhong Yuan
2019-11-22  5:43 ` Vinod Koul

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org
	public-inbox-index dmaengine

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git