From f4f350b361d858131ca67f2b13ab3815e1a5ad26 Mon Sep 17 00:00:00 2001
From: Vignesh Raghavendra <vigneshr@ti.com>
Date: Tue, 13 Dec 2022 22:49:03 +0530
Subject: [PATCH] dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN

Reusing loop iterator fails if BCHAN is not present as iterator is
uninitialized

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/dma/ti/k3-udma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 3a0582f99208..7dcaf7a1eedb 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -4757,7 +4757,10 @@ static int bcdma_setup_resources(struct udma_dev *ud)
 						oes->bcdma_bchan_ring;
 			irq_res.desc[i].num = rm_res->desc[i].num;
 		}
+	} else {
+		i = 0;
 	}
+
 	if (ud->tchan_cnt) {
 		rm_res = tisci_rm->rm_ranges[RM_RANGE_TCHAN];
 		for (j = 0; j < rm_res->sets; j++, i += 2) {
