Skip to contentSkip to conversation

dmaengine: mv_xor: Minor coding style fix

PATCH New Stefan Roese 3 participants 4 messages Jun 1, 2016 – Jun 7, 2016 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dmaengine: mv_xor: Minor coding style fix

Remove the space before the "err_free_dma:" label in mv_xor_channel_add().

Cc Gregory CLEMENT <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Marcin Wojtas <[email protected]>
Cc Vinod Koul <[email protected]>
---
 drivers/dma/mv_xor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/mv_xor.c +1 -1
index 25d1dad..55815c1 100644
@@ -1055,7 +1055,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
 
 err_free_irq:
 	free_irq(mv_chan->irq, mv_chan);
- err_free_dma:
+err_free_dma:
 	dma_free_coherent(&pdev->dev, MV_XOR_POOL_SIZE,
 			  mv_chan->dma_desc_pool_virt, mv_chan->dma_desc_pool);
 	return ERR_PTR(ret);
Signature · 1 line
2.8.3
#1 lore raw

PATCH 2/2 dmaengine: mv_xor: Fix incorrect offset in dma_map_page()

Upon booting, I occasionally spotted some BUGs triggered by the internal DMA test routine executed upon driver probing. This was detected by SLUB_DEBUG ("Freechain corrupt" or "Redzone overwritten"). Tracking this down located a problem in passing 0 as offset in dma_map_page(). As kmalloc, especially when used with SLUB_DEBUG, may return a non page aligned address.

This patch fixes this issue by passing the correct offset in dma_map_page().

Tested on a custom Armada XP board.

Cc Thomas Petazzoni <[email protected]>
Cc Gregory CLEMENT <[email protected]>
Cc Marcin Wojtas <[email protected]>
Cc Vinod Koul <[email protected]>
---
 drivers/dma/mv_xor.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/dma/mv_xor.c +6 -4
index 55815c1..f4c9f98 100644
@@ -703,8 +703,9 @@ static int mv_chan_memcpy_self_test(struct mv_xor_chan *mv_chan)
 		goto free_resources;
 	}
 
-	src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src), 0,
-				 PAGE_SIZE, DMA_TO_DEVICE);
+	src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src),
+			       (size_t)src & ~PAGE_MASK, PAGE_SIZE,
+			       DMA_TO_DEVICE);
 	unmap->addr[0] = src_dma;
 
 	ret = dma_mapping_error(dma_chan->device->dev, src_dma);
@@ -714,8 +715,9 @@ static int mv_chan_memcpy_self_test(struct mv_xor_chan *mv_chan)
 	}
 	unmap->to_cnt = 1;
 
-	dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest), 0,
-				  PAGE_SIZE, DMA_FROM_DEVICE);
+	dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest),
+				(size_t)dest & ~PAGE_MASK, PAGE_SIZE,
+				DMA_FROM_DEVICE);
 	unmap->addr[1] = dest_dma;
 
 	ret = dma_mapping_error(dma_chan->device->dev, dest_dma);
Signature · 1 line
2.8.3
#2 lore raw

PATCH 1/2 dmaengine: mv_xor: Minor coding style fix

In reply to Stefan Roese

Hello,

Quoted 10 lines · Stefan Roese

Remove the space before the "err_free_dma:" label in mv_xor_channel_add().

Cc Gregory CLEMENT <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Marcin Wojtas <[email protected]>
Cc Vinod Koul <[email protected]>
---
 drivers/dma/mv_xor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Applied
#3 lore raw

PATCH 1/2 dmaengine: mv_xor: Minor coding style fix

In reply to Stefan Roese
Quoted 1 line · Stefan Roese

Remove the space before the "err_free_dma:" label in mv_xor_channel_add().

Applied, both.

Thanks

Signature · 1 line
~Vinod