dmaengine: ste_dma40: use proper format string for resource_size_t

Message ID 20230517201951.619693-1-arnd@kernel.org
State New
Headers
Series dmaengine: ste_dma40: use proper format string for resource_size_t |

Commit Message

Arnd Bergmann May 17, 2023, 8:19 p.m. UTC
  From: Arnd Bergmann <arnd@arndb.de>

When LPAE is set, both the dma_addr_t and resource_size_t become 64 bit
wide, causing a warning about the format string:

drivers/dma/ste_dma40.c: In function 'd40_probe':
drivers/dma/ste_dma40.c:3539:23: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=]
 3539 |         dev_info(dev, "found LCPA SRAM at 0x%08x, size 0x%08x\n",

Change both to the special %pap and %pap helpers for these types.

Fixes: 5a1a3b9c19dd ("dmaengine: ste_dma40: Get LCPA SRAM from SRAM node")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/dma/ste_dma40.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Vinod Koul May 18, 2023, 11:29 a.m. UTC | #1
On 17-05-23, 22:19, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When LPAE is set, both the dma_addr_t and resource_size_t become 64 bit
> wide, causing a warning about the format string:
> 
> drivers/dma/ste_dma40.c: In function 'd40_probe':
> drivers/dma/ste_dma40.c:3539:23: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=]
>  3539 |         dev_info(dev, "found LCPA SRAM at 0x%08x, size 0x%08x\n",
> 
> Change both to the special %pap and %pap helpers for these types.

Already posted [1] and applied now

[1]: https://lore.kernel.org/r/20230517064434.141091-1-vkoul@kernel.org
  
Arnd Bergmann May 18, 2023, 11:59 a.m. UTC | #2
On Thu, May 18, 2023, at 13:29, Vinod Koul wrote:
> On 17-05-23, 22:19, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> When LPAE is set, both the dma_addr_t and resource_size_t become 64 bit
>> wide, causing a warning about the format string:
>> 
>> drivers/dma/ste_dma40.c: In function 'd40_probe':
>> drivers/dma/ste_dma40.c:3539:23: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=]
>>  3539 |         dev_info(dev, "found LCPA SRAM at 0x%08x, size 0x%08x\n",
>> 
>> Change both to the special %pap and %pap helpers for these types.
>
> Already posted [1] and applied now
>
> [1]: https://lore.kernel.org/r/20230517064434.141091-1-vkoul@kernel.org

I think yours is wrong: you use %pR with a resource_size_t, but it
expects a "struct resource instead".

      Arnd
  
Vinod Koul May 19, 2023, 10:46 a.m. UTC | #3
On 18-05-23, 13:59, Arnd Bergmann wrote:
> On Thu, May 18, 2023, at 13:29, Vinod Koul wrote:
> > On 17-05-23, 22:19, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >> 
> >> When LPAE is set, both the dma_addr_t and resource_size_t become 64 bit
> >> wide, causing a warning about the format string:
> >> 
> >> drivers/dma/ste_dma40.c: In function 'd40_probe':
> >> drivers/dma/ste_dma40.c:3539:23: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=]
> >>  3539 |         dev_info(dev, "found LCPA SRAM at 0x%08x, size 0x%08x\n",
> >> 
> >> Change both to the special %pap and %pap helpers for these types.
> >
> > Already posted [1] and applied now
> >
> > [1]: https://lore.kernel.org/r/20230517064434.141091-1-vkoul@kernel.org
> 
> I think yours is wrong: you use %pR with a resource_size_t, but it
> expects a "struct resource instead".

Right, i indeed looked up wrong format
  

Patch

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 9ff6dd9e2fa2..dbc988cfc4bf 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3536,8 +3536,8 @@  static int __init d40_probe(struct platform_device *pdev)
 	}
 	base->lcpa_size = resource_size(&res_lcpa);
 	base->phy_lcpa = res_lcpa.start;
-	dev_info(dev, "found LCPA SRAM at 0x%08x, size 0x%08x\n",
-		 (u32)base->phy_lcpa, base->lcpa_size);
+	dev_info(dev, "found LCPA SRAM at %pad, size %pa\n",
+		 &base->phy_lcpa, &base->lcpa_size);
 
 	/* We make use of ESRAM memory for this. */
 	val = readl(base->virtbase + D40_DREG_LCPA);