Skip to contentSkip to conversation

dmaengine: at_hdmac: fix dma_addr_t printing

PATCH In review Arnd Bergmann 4 participants 4 messages Dec 8, 2015 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: at_hdmac: fix dma_addr_t printing

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.

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(-)
drivers/dma/at_hdmac_regs.h +2 -2
index 610907dbc11a..0474e4a0f02a 100644
@@ -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);
 }
 
 
Signature · 1 line
2.1.0.rc2
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Arnd Bergmann

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:

Quoted 8 lines

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.

Fixes 096117032a36 ("dmaengine: do not use 0x in front of %pad")

Yep, thanks Arnd!

Quoted 20 lines
---
 drivers/dma/at_hdmac_regs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/at_hdmac_regs.h +2 -2
index 610907dbc11a..0474e4a0f02a 100644
@@ -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);
 }
 
 
Signature · 1 line
Nicolas Ferre
#2 lore raw
Quoted 2 lines
Quoted 2 lines

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

#3 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

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...

Quoted 26 lines
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(-)
drivers/dma/at_hdmac_regs.h +2 -2
index 610907dbc11a..0474e4a0f02a 100644
@@ -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);
 }
 
 
Signature · 1 line
2.1.0.rc2
Signature · 1 line
~Vinod