Skip to contentSkip to conversation

EDMA: TI: fixed wrongly initialized data parameter to the edma callback

PATCH In review Petr Kulhavy 3 participants 3 messages Mar 23, 2015 – Apr 1, 2015 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 EDMA: TI: fixed wrongly initialized data parameter to the edma callback

The "data" parameter passed indirectly to the edma_callback() should be edma_chan and not the dma_chan.

This bug was so far harmless since the offset of struct dma_chan within struct edma_chan is 0. However as soon as someone changes struct edma_chan this would cause troubles.

---
 drivers/dma/edma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/edma.c +1 -1
index 1465610..4c8208b 100644
@@ -813,7 +813,7 @@ static int edma_alloc_chan_resources(struct dma_chan *chan)
 	LIST_HEAD(descs);
 
 	a_ch_num = edma_alloc_channel(echan->ch_num, edma_callback,
-					chan, EVENTQ_DEFAULT);
+					echan, EVENTQ_DEFAULT);
 
 	if (a_ch_num < 0) {
 		ret = -ENODEV;
Signature · 1 line
1.9.1
Acked-by on v1 2/2
#1 lore raw
Quoted 6 lines · Petr Kulhavy

The "data" parameter passed indirectly to the edma_callback() should be edma_chan and not the dma_chan.

This bug was so far harmless since the offset of struct dma_chan within struct edma_chan is 0. However as soon as someone changes struct edma_chan this would cause troubles.

Good catch. This seams to be in the code since the first commit ;)

Quoted 19 lines
---
 drivers/dma/edma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/edma.c +1 -1
index 1465610..4c8208b 100644
@@ -813,7 +813,7 @@ static int edma_alloc_chan_resources(struct dma_chan *chan)
 	LIST_HEAD(descs);
 
 	a_ch_num = edma_alloc_channel(echan->ch_num, edma_callback,
-					chan, EVENTQ_DEFAULT);
+					echan, EVENTQ_DEFAULT);
 
 	if (a_ch_num < 0) {
 		ret = -ENODEV;
#2 lore raw
In reply to Petr Kulhavy
Quoted 6 lines · Petr Kulhavy

The "data" parameter passed indirectly to the edma_callback() should be edma_chan and not the dma_chan.

This bug was so far harmless since the offset of struct dma_chan within struct edma_chan is 0. However as soon as someone changes struct edma_chan this would cause troubles.

Applied now, but do ensure you are using right subsystem anmes for patches. I have fixed up now

Signature · 1 line
~Vinod