Skip to contentSkip to conversation

dmaengine: ti: edma: fix missed failure handling

PATCH Applied Chuhong Yuan 2 participants 2 messages Nov 18, 2019 – Nov 22, 2019

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 dmaengine: ti: edma: fix missed failure handling

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")
---
 drivers/dma/ti/edma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/ti/edma.c +4 -2
index 8be32fd9f762..79bc8503cf32 100644
@@ -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",
Signature · 1 line
2.24.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Chuhong Yuan

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

Applied, thanks

Signature · 1 line
~Vinod