diff mbox

DaVinci: EDMA: Fix bug in edma_free_cont_slots API

Message ID 1253138999-15590-1-git-send-email-s-paulraj@ti.com (mailing list archive)
State Accepted
Headers show

Commit Message

s-paulraj@ti.com Sept. 16, 2009, 10:09 p.m. UTC
From: Sandeep Paulraj <s-paulraj@ti.com>

In the edma_free_cont_slots API, the variable slot was being modified
and then used in the for loop.
This results in incorrect behaviour when the API is used.

Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
---
 arch/arm/mach-davinci/dma.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Comments

Kevin Hilman Sept. 28, 2009, 6:42 p.m. UTC | #1
s-paulraj@ti.com writes:

> From: Sandeep Paulraj <s-paulraj@ti.com>
>
> In the edma_free_cont_slots API, the variable slot was being modified
> and then used in the for loop.
> This results in incorrect behaviour when the API is used.
>
> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
> ---
>  arch/arm/mach-davinci/dma.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)

Applied to davinci git, queuing for 2.6.32 fixes.

Kevin

> diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
> index f2e57d2..89ce3e1 100644
> --- a/arch/arm/mach-davinci/dma.c
> +++ b/arch/arm/mach-davinci/dma.c
> @@ -813,7 +813,7 @@ EXPORT_SYMBOL(edma_alloc_cont_slots);
>   */
>  int edma_free_cont_slots(unsigned slot, int count)
>  {
> -	unsigned ctlr;
> +	unsigned ctlr, slot_to_free;
>  	int i;
>  
>  	ctlr = EDMA_CTLR(slot);
> @@ -826,11 +826,11 @@ int edma_free_cont_slots(unsigned slot, int count)
>  
>  	for (i = slot; i < slot + count; ++i) {
>  		ctlr = EDMA_CTLR(i);
> -		slot = EDMA_CHAN_SLOT(i);
> +		slot_to_free = EDMA_CHAN_SLOT(i);
>  
> -		memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(slot),
> +		memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(slot_to_free),
>  			&dummy_paramset, PARM_SIZE);
> -		clear_bit(slot, edma_info[ctlr]->edma_inuse);
> +		clear_bit(slot_to_free, edma_info[ctlr]->edma_inuse);
>  	}
>  
>  	return 0;
> -- 
> 1.6.0.4
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index f2e57d2..89ce3e1 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -813,7 +813,7 @@  EXPORT_SYMBOL(edma_alloc_cont_slots);
  */
 int edma_free_cont_slots(unsigned slot, int count)
 {
-	unsigned ctlr;
+	unsigned ctlr, slot_to_free;
 	int i;
 
 	ctlr = EDMA_CTLR(slot);
@@ -826,11 +826,11 @@  int edma_free_cont_slots(unsigned slot, int count)
 
 	for (i = slot; i < slot + count; ++i) {
 		ctlr = EDMA_CTLR(i);
-		slot = EDMA_CHAN_SLOT(i);
+		slot_to_free = EDMA_CHAN_SLOT(i);
 
-		memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(slot),
+		memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(slot_to_free),
 			&dummy_paramset, PARM_SIZE);
-		clear_bit(slot, edma_info[ctlr]->edma_inuse);
+		clear_bit(slot_to_free, edma_info[ctlr]->edma_inuse);
 	}
 
 	return 0;