linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: at_hdmac: fix dma_addr_t printing
@ 2015-12-08 15:34 Arnd Bergmann
  2015-12-08 16:04 ` Nicolas Ferre
  2015-12-08 16:18 ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2015-12-08 15:34 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Dmitry V. Krivenok, Nicolas Ferre, linux-arm-kernel,
	linux-kernel, Dan Williams, dmaengine

A recent patch tried to improve the printk output of the atc_dump_lli()
function but introduced a bug, in which we end up dereferencing a
dma address as a pointer, and we even get a warning for it:

drivers/dma/at_hdmac_regs.h: In function 'atc_dump_lli':
drivers/dma/at_hdmac_regs.h:388:4: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]

This changes the code to pass the DMA address by reference, as expected
by printk.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 096117032a36 ("dmaengine: do not use 0x in front of %pad")
---
 drivers/dma/at_hdmac_regs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
index 610907dbc11a..0474e4a0f02a 100644
--- a/drivers/dma/at_hdmac_regs.h
+++ b/drivers/dma/at_hdmac_regs.h
@@ -386,8 +386,8 @@ static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)
 {
 	dev_crit(chan2dev(&atchan->chan_common),
 		 "  desc: s%pad d%pad ctrl0x%x:0x%x l%pad\n",
-		 lli->saddr, lli->daddr,
-		 lli->ctrla, lli->ctrlb, lli->dscr);
+		 &lli->saddr, &lli->daddr,
+		 lli->ctrla, lli->ctrlb, &lli->dscr);
 }
 
 
-- 
2.1.0.rc2



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

* Re: [PATCH] dmaengine: at_hdmac: fix dma_addr_t printing
  2015-12-08 15:34 [PATCH] dmaengine: at_hdmac: fix dma_addr_t printing Arnd Bergmann
@ 2015-12-08 16:04 ` Nicolas Ferre
  2015-12-08 16:23   ` Dmitry Krivenok
  2015-12-08 16:18 ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Ferre @ 2015-12-08 16:04 UTC (permalink / raw)
  To: Arnd Bergmann, Vinod Koul
  Cc: Dmitry V. Krivenok, linux-arm-kernel, linux-kernel, Dan Williams,
	dmaengine

Le 08/12/2015 16:34, Arnd Bergmann a écrit :
> A recent patch tried to improve the printk output of the atc_dump_lli()
> function but introduced a bug, in which we end up dereferencing a
> dma address as a pointer, and we even get a warning for it:
> 
> drivers/dma/at_hdmac_regs.h: In function 'atc_dump_lli':
> drivers/dma/at_hdmac_regs.h:388:4: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
> 
> This changes the code to pass the DMA address by reference, as expected
> by printk.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 096117032a36 ("dmaengine: do not use 0x in front of %pad")

Yep, thanks Arnd!

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  drivers/dma/at_hdmac_regs.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
> index 610907dbc11a..0474e4a0f02a 100644
> --- a/drivers/dma/at_hdmac_regs.h
> +++ b/drivers/dma/at_hdmac_regs.h
> @@ -386,8 +386,8 @@ static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)
>  {
>  	dev_crit(chan2dev(&atchan->chan_common),
>  		 "  desc: s%pad d%pad ctrl0x%x:0x%x l%pad\n",
> -		 lli->saddr, lli->daddr,
> -		 lli->ctrla, lli->ctrlb, lli->dscr);
> +		 &lli->saddr, &lli->daddr,
> +		 lli->ctrla, lli->ctrlb, &lli->dscr);
>  }
>  
>  
> 


-- 
Nicolas Ferre

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

* Re: [PATCH] dmaengine: at_hdmac: fix dma_addr_t printing
  2015-12-08 15:34 [PATCH] dmaengine: at_hdmac: fix dma_addr_t printing Arnd Bergmann
  2015-12-08 16:04 ` Nicolas Ferre
@ 2015-12-08 16:18 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2015-12-08 16:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Dmitry V. Krivenok, Nicolas Ferre, linux-arm-kernel,
	linux-kernel, Dan Williams, dmaengine

On Tue, Dec 08, 2015 at 04:34:28PM +0100, Arnd Bergmann wrote:
> A recent patch tried to improve the printk output of the atc_dump_lli()
> function but introduced a bug, in which we end up dereferencing a
> dma address as a pointer, and we even get a warning for it:
> 
> drivers/dma/at_hdmac_regs.h: In function 'atc_dump_lli':
> drivers/dma/at_hdmac_regs.h:388:4: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
> 
> This changes the code to pass the DMA address by reference, as expected
> by printk.

Thanks for this but i was planning to drop 096117032a36 "dmaengine: do not
use 0x in front of %pad" as recomended by Dmitry, so we should fix this
cleanly

I will push out updated tree in a short while...

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 096117032a36 ("dmaengine: do not use 0x in front of %pad")
> ---
>  drivers/dma/at_hdmac_regs.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
> index 610907dbc11a..0474e4a0f02a 100644
> --- a/drivers/dma/at_hdmac_regs.h
> +++ b/drivers/dma/at_hdmac_regs.h
> @@ -386,8 +386,8 @@ static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)
>  {
>  	dev_crit(chan2dev(&atchan->chan_common),
>  		 "  desc: s%pad d%pad ctrl0x%x:0x%x l%pad\n",
> -		 lli->saddr, lli->daddr,
> -		 lli->ctrla, lli->ctrlb, lli->dscr);
> +		 &lli->saddr, &lli->daddr,
> +		 lli->ctrla, lli->ctrlb, &lli->dscr);
>  }
>  
>  
> -- 
> 2.1.0.rc2
> 
> 

-- 
~Vinod

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

* Re: [PATCH] dmaengine: at_hdmac: fix dma_addr_t printing
  2015-12-08 16:04 ` Nicolas Ferre
@ 2015-12-08 16:23   ` Dmitry Krivenok
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Krivenok @ 2015-12-08 16:23 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Arnd Bergmann, Vinod Koul, linux-arm-kernel, linux-kernel,
	Dan Williams, dmaengine

>> A recent patch tried to improve the printk output of the atc_dump_lli()
>> function but introduced a bug

BTW, my original patch was created for mainline and was incorrectly
applied to slave-dma.git for-linus branch (I sent Vinod an email about
that).
In that branch the code was already changed so that my patch didn't
make sense there.
Now you seem to revert the change that was originally made instead of
revering my 1 line change:) Is that intentional?

Thanks,
Dmitry

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

end of thread, other threads:[~2015-12-08 16:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08 15:34 [PATCH] dmaengine: at_hdmac: fix dma_addr_t printing Arnd Bergmann
2015-12-08 16:04 ` Nicolas Ferre
2015-12-08 16:23   ` Dmitry Krivenok
2015-12-08 16:18 ` 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).