[PATCH 2/5] dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN

Vignesh Raghavendra posted 5 patches 2 years, 9 months ago
There is a newer version of this series
[PATCH 2/5] dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN
Posted by Vignesh Raghavendra 2 years, 9 months ago
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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index ce8b80bb34d7..791cf6354946 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -4758,6 +4758,7 @@ static int bcdma_setup_resources(struct udma_dev *ud)
 		}
 	}
 
+	i = 0;
 	irq_res.desc = kcalloc(irq_res.sets, sizeof(*irq_res.desc), GFP_KERNEL);
 	if (!irq_res.desc)
 		return -ENOMEM;
-- 
2.38.1
Re: [PATCH 2/5] dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN
Posted by Péter Ujfalusi 2 years, 9 months ago

On 12/6/22 06:35, Vignesh Raghavendra wrote:
> 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 | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index ce8b80bb34d7..791cf6354946 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -4758,6 +4758,7 @@ static int bcdma_setup_resources(struct udma_dev *ud)
>  		}
>  	}
>  
> +	i = 0;

I think this would be more appropriate:
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index ce8b80bb34d7..7f8737da3613 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -4774,6 +4774,8 @@ static int bcdma_setup_resources(struct udma_dev *ud)
 				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];


>  	irq_res.desc = kcalloc(irq_res.sets, sizeof(*irq_res.desc), GFP_KERNEL);
>  	if (!irq_res.desc)
>  		return -ENOMEM;


-- 
Péter
Re: [PATCH 2/5] dmaengine: ti: k3-udma: Fix BCDMA for case w/o BCHAN
Posted by Vignesh Raghavendra 2 years, 9 months ago
Hi Peter,

On 10/12/22 13:54, Péter Ujfalusi wrote:
> 
> 
> On 12/6/22 06:35, Vignesh Raghavendra wrote:
>> 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 | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
>> index ce8b80bb34d7..791cf6354946 100644
>> --- a/drivers/dma/ti/k3-udma.c
>> +++ b/drivers/dma/ti/k3-udma.c
>> @@ -4758,6 +4758,7 @@ static int bcdma_setup_resources(struct udma_dev *ud)
>>  		}
>>  	}
>>  
>> +	i = 0;
> 
> I think this would be more appropriate:
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index ce8b80bb34d7..7f8737da3613 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -4774,6 +4774,8 @@ static int bcdma_setup_resources(struct udma_dev *ud)
>  				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];
> 
> 

Agreed, will update in v2.

>>  	irq_res.desc = kcalloc(irq_res.sets, sizeof(*irq_res.desc), GFP_KERNEL);
>>  	if (!irq_res.desc)
>>  		return -ENOMEM;
> 
> 

-- 
Regards
Vignesh