linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix
@ 2016-06-01 10:43 Stefan Roese
  2016-06-01 10:43 ` [PATCH 2/2] dmaengine: mv_xor: Fix incorrect offset in dma_map_page() Stefan Roese
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Roese @ 2016-06-01 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Vinod Koul <vinod.koul@intel.com>
---
 drivers/dma/mv_xor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 25d1dad..55815c1 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -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);
-- 
2.8.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] dmaengine: mv_xor: Fix incorrect offset in dma_map_page()
  2016-06-01 10:43 [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix Stefan Roese
@ 2016-06-01 10:43 ` Stefan Roese
  2016-06-01 11:47 ` [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix Thomas Petazzoni
  2016-06-07  7:14 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2016-06-01 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Vinod Koul <vinod.koul@intel.com>
---
 drivers/dma/mv_xor.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 55815c1..f4c9f98 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -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);
-- 
2.8.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix
  2016-06-01 10:43 [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix Stefan Roese
  2016-06-01 10:43 ` [PATCH 2/2] dmaengine: mv_xor: Fix incorrect offset in dma_map_page() Stefan Roese
@ 2016-06-01 11:47 ` Thomas Petazzoni
  2016-06-07  7:14 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2016-06-01 11:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On Wed,  1 Jun 2016 12:43:31 +0200, Stefan Roese wrote:
> Remove the space before the "err_free_dma:" label in mv_xor_channel_add().
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Marcin Wojtas <mw@semihalf.com>
> Cc: Vinod Koul <vinod.koul@intel.com>
> ---
>  drivers/dma/mv_xor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix
  2016-06-01 10:43 [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix Stefan Roese
  2016-06-01 10:43 ` [PATCH 2/2] dmaengine: mv_xor: Fix incorrect offset in dma_map_page() Stefan Roese
  2016-06-01 11:47 ` [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix Thomas Petazzoni
@ 2016-06-07  7:14 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2016-06-07  7:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 01, 2016 at 12:43:31PM +0200, Stefan Roese wrote:
> Remove the space before the "err_free_dma:" label in mv_xor_channel_add().

Applied, both.

Thanks
-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-07  7:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-01 10:43 [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix Stefan Roese
2016-06-01 10:43 ` [PATCH 2/2] dmaengine: mv_xor: Fix incorrect offset in dma_map_page() Stefan Roese
2016-06-01 11:47 ` [PATCH 1/2] dmaengine: mv_xor: Minor coding style fix Thomas Petazzoni
2016-06-07  7:14 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).