linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] EDAC/aspeed: use proper format string for printing resource
@ 2021-04-21 13:54 Arnd Bergmann
  2021-04-27  2:22 ` Andrew Jeffery
  2021-05-18 14:51 ` Borislav Petkov
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-04-21 13:54 UTC (permalink / raw)
  To: Stefan Schaeckeler, Borislav Petkov, Mauro Carvalho Chehab,
	Tony Luck, Joel Stanley, Troy Lee
  Cc: Arnd Bergmann, James Morse, Robert Richter, Andrew Jeffery,
	Krzysztof Kozlowski, Liu Shixin, linux-edac, linux-arm-kernel,
	linux-aspeed, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

On ARMv7, resource_size_t can be 64-bit, which breaks printing
it as %x:

drivers/edac/aspeed_edac.c: In function 'init_csrows':
drivers/edac/aspeed_edac.c:257:28: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=]
  257 |         dev_dbg(mci->pdev, "dt: /memory node resources: first page r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",

Use the special %pR format string to pretty-print the entire
resource instead.

Fixes: edfc2d73ca45 ("EDAC/aspeed: Add support for AST2400 and AST2600")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/edac/aspeed_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
index a46da56d6d54..6bd5f8815919 100644
--- a/drivers/edac/aspeed_edac.c
+++ b/drivers/edac/aspeed_edac.c
@@ -254,8 +254,8 @@ static int init_csrows(struct mem_ctl_info *mci)
 		return rc;
 	}
 
-	dev_dbg(mci->pdev, "dt: /memory node resources: first page r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
-		r.start, resource_size(&r), PAGE_SHIFT);
+	dev_dbg(mci->pdev, "dt: /memory node resources: first page %pR, PAGE_SHIFT macro=0x%x\n",
+		&r, PAGE_SHIFT);
 
 	csrow->first_page = r.start >> PAGE_SHIFT;
 	nr_pages = resource_size(&r) >> PAGE_SHIFT;
-- 
2.29.2


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

* Re: [PATCH] EDAC/aspeed: use proper format string for printing resource
  2021-04-21 13:54 [PATCH] EDAC/aspeed: use proper format string for printing resource Arnd Bergmann
@ 2021-04-27  2:22 ` Andrew Jeffery
  2021-05-18 14:51 ` Borislav Petkov
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Jeffery @ 2021-04-27  2:22 UTC (permalink / raw)
  To: Arnd Bergmann, Stefan M Schaeckeler, Borislav Petkov,
	Mauro Carvalho Chehab, Tony Luck, Joel Stanley, Troy Lee
  Cc: Arnd Bergmann, James Morse, Robert Richter, Krzysztof Kozlowski,
	Liu Shixin, linux-edac, linux-arm-kernel, linux-aspeed,
	linux-kernel



On Wed, 21 Apr 2021, at 23:24, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> On ARMv7, resource_size_t can be 64-bit, which breaks printing
> it as %x:
> 
> drivers/edac/aspeed_edac.c: In function 'init_csrows':
> drivers/edac/aspeed_edac.c:257:28: error: format '%x' expects argument 
> of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 
> 'long long unsigned int'} [-Werror=format=]
>   257 |         dev_dbg(mci->pdev, "dt: /memory node resources: first 
> page r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
> 
> Use the special %pR format string to pretty-print the entire
> resource instead.
> 
> Fixes: edfc2d73ca45 ("EDAC/aspeed: Add support for AST2400 and AST2600")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/edac/aspeed_edac.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
> index a46da56d6d54..6bd5f8815919 100644
> --- a/drivers/edac/aspeed_edac.c
> +++ b/drivers/edac/aspeed_edac.c
> @@ -254,8 +254,8 @@ static int init_csrows(struct mem_ctl_info *mci)
>  		return rc;
>  	}
>  
> -	dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
> -		r.start, resource_size(&r), PAGE_SHIFT);
> +	dev_dbg(mci->pdev, "dt: /memory node resources: first page %pR, PAGE_SHIFT macro=0x%x\n",

Could probably drop the "first page " as well, but it's a dev_dbg() and not a big deal.

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

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

* Re: [PATCH] EDAC/aspeed: use proper format string for printing resource
  2021-04-21 13:54 [PATCH] EDAC/aspeed: use proper format string for printing resource Arnd Bergmann
  2021-04-27  2:22 ` Andrew Jeffery
@ 2021-05-18 14:51 ` Borislav Petkov
  1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2021-05-18 14:51 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Stefan Schaeckeler, Mauro Carvalho Chehab, Tony Luck,
	Joel Stanley, Troy Lee, Arnd Bergmann, James Morse,
	Robert Richter, Andrew Jeffery, Krzysztof Kozlowski, Liu Shixin,
	linux-edac, linux-arm-kernel, linux-aspeed, linux-kernel

On Wed, Apr 21, 2021 at 03:54:53PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> On ARMv7, resource_size_t can be 64-bit, which breaks printing
> it as %x:
> 
> drivers/edac/aspeed_edac.c: In function 'init_csrows':
> drivers/edac/aspeed_edac.c:257:28: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=]
>   257 |         dev_dbg(mci->pdev, "dt: /memory node resources: first page r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
> 
> Use the special %pR format string to pretty-print the entire
> resource instead.
> 
> Fixes: edfc2d73ca45 ("EDAC/aspeed: Add support for AST2400 and AST2600")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/edac/aspeed_edac.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
> index a46da56d6d54..6bd5f8815919 100644
> --- a/drivers/edac/aspeed_edac.c
> +++ b/drivers/edac/aspeed_edac.c
> @@ -254,8 +254,8 @@ static int init_csrows(struct mem_ctl_info *mci)
>  		return rc;
>  	}
>  
> -	dev_dbg(mci->pdev, "dt: /memory node resources: first page r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
> -		r.start, resource_size(&r), PAGE_SHIFT);
> +	dev_dbg(mci->pdev, "dt: /memory node resources: first page %pR, PAGE_SHIFT macro=0x%x\n",
> +		&r, PAGE_SHIFT);
>  
>  	csrow->first_page = r.start >> PAGE_SHIFT;
>  	nr_pages = resource_size(&r) >> PAGE_SHIFT;
> -- 

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

end of thread, other threads:[~2021-05-18 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 13:54 [PATCH] EDAC/aspeed: use proper format string for printing resource Arnd Bergmann
2021-04-27  2:22 ` Andrew Jeffery
2021-05-18 14:51 ` Borislav Petkov

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