diff mbox series

[2/2] dmaengine: ti: edma: fix missed failure handling

Message ID 20191118073802.28424-1-hslester96@gmail.com (mailing list archive)
State Accepted
Headers show
Series [1/2] dmaengine: ti: edma: add missed pm_runtime_disable | expand

Commit Message

Chuhong Yuan Nov. 18, 2019, 7:38 a.m. UTC
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(-)

Comments

Vinod Koul Nov. 22, 2019, 5:43 a.m. UTC | #1
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
diff mbox series

Patch

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",