EDAC: aspeed: print resource_size_t using %pa
Subsystems (3)
PATCH 1/1 EDAC: aspeed: print resource_size_t using %pa
Fix build warnings for using "%x" to print resource_size_t in 2 places. resource_size_t can be either of u32 or u64. We have a special format "%pa" for printing a resource_size_t, which is the same as a phys_addr_t. See Documentation/core-api/printk-formats.rst.
CC drivers/edac/aspeed_edac.o../drivers/edac/aspeed_edac.c: In function 'init_csrows':../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
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",
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",
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",
../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
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",
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",
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",---
Found in linux-next but applies to mainline.
drivers/edac/aspeed_edac.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/edac/aspeed_edac.c +5 -3
@@ -234,6 +234,7 @@ static int init_csrows(struct mem_ctl_inu32 nr_pages, dram_type;struct dimm_info *dimm;struct device_node *np; +resource_size_t rsize;struct resource r;u32 reg04;int rc;
@@ -254,11 +255,12 @@ static int init_csrows(struct mem_ctl_inreturn 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 ); + rsize =resource_size (&r); +dev_dbg (mci->pdev,"dt: /memory node resources: first page r.start=0x%pa, resource_size=0x%pa, PAGE_SHIFT macro=0x%x\n" , + &r.start, &rsize,PAGE_SHIFT ); csrow->first_page = r.start >>PAGE_SHIFT ; - nr_pages =resource_size (&r) >>PAGE_SHIFT ; + nr_pages = rsize >>PAGE_SHIFT ; csrow->last_page = csrow->first_page + nr_pages -1 ;regmap_read (aspeed_regmap,ASPEED_MCR_CONF , ®04);
Quoted 55 lines · Randy Dunlap
Fix build warnings for using "%x" to print
resource_size_tin 2 places.resource_size_tcan be either of u32 or u64. We have a special format "%pa" for printing aresource_size_t, which is the same as aphys_addr_t. SeeDocumentation/core-api/printk-formats.rst.CC
drivers/edac/aspeed_edac.o../drivers/edac/aspeed_edac.c: In function 'init_csrows':../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",Fixes 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")Signed-off-by Randy Dunlap <[email protected]>Reported-by kernel test robot <[email protected]>Cc Troy Lee <[email protected]>Cc Stefan Schaeckeler <[email protected]>Cc linux-edac at vger.kernel.orgCc Borislav Petkov <[email protected]>Cc Borislav Petkov <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Cc Tony Luck <[email protected]>Cc linux-aspeed at lists.ozlabs.org---
Found in linux-next but applies to mainline.drivers/edac/aspeed_edac.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/edac/aspeed_edac.c +1
-0@@ -234,6 +234,7 @@ static int init_csrows(struct mem_ctl_inu32 nr_pages, dram_type;struct dimm_info *dimm;struct device_node *np; +resource_size_t rsize;struct resource r;u32 reg04;int rc;
drivers/edac/aspeed_edac.c static int init_csrows(struct mem_ctl_in · line 262
Quoted 10 lines
drivers/edac/aspeed_edac.c +3
-2@@ -254,11 +255,12 @@ static int init_csrows(struct mem_ctl_inreturn 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); + rsize = resource_size(&r); + dev_dbg(mci->pdev, "dt: /memory node resources: first page r.start=0x%pa, resource_size=0x%pa, PAGE_SHIFT macro=0x%x\n", + &r.start, &rsize,PAGE_SHIFT );
Arnd posted a fix a few days back that feels more intuitive, though probably could have cleaned up the grammar:
https://lore.kernel.org/lkml/20210421135500.3518661-1-arnd at kernel.org/
Andrew
Quoted 72 lines · Andrew Jeffery
Quoted 55 lines · Randy Dunlap
Fix build warnings for using "%x" to print
resource_size_tin 2 places.resource_size_tcan be either of u32 or u64. We have a special format "%pa" for printing aresource_size_t, which is the same as aphys_addr_t. SeeDocumentation/core-api/printk-formats.rst.CC
drivers/edac/aspeed_edac.o../drivers/edac/aspeed_edac.c: In function 'init_csrows':../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",Fixes 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")Signed-off-by Randy Dunlap <[email protected]>Reported-by kernel test robot <[email protected]>Cc Troy Lee <[email protected]>Cc Stefan Schaeckeler <[email protected]>Cc linux-edac at vger.kernel.orgCc Borislav Petkov <[email protected]>Cc Borislav Petkov <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Cc Tony Luck <[email protected]>Cc linux-aspeed at lists.ozlabs.org---
Found in linux-next but applies to mainline.drivers/edac/aspeed_edac.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/edac/aspeed_edac.c +1
-0@@ -234,6 +234,7 @@ static int init_csrows(struct mem_ctl_inu32 nr_pages, dram_type;struct dimm_info *dimm;struct device_node *np; +resource_size_t rsize;struct resource r;u32 reg04;int rc;drivers/edac/aspeed_edac.c static int init_csrows(struct mem_ctl_in · line 262
Quoted 10 lines
drivers/edac/aspeed_edac.c +3
-2@@ -254,11 +255,12 @@ static int init_csrows(struct mem_ctl_inreturn 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); + rsize = resource_size(&r); + dev_dbg(mci->pdev, "dt: /memory node resources: first page r.start=0x%pa, resource_size=0x%pa, PAGE_SHIFT macro=0x%x\n", + &r.start, &rsize,PAGE_SHIFT );Arnd posted a fix a few days back that feels more intuitive, though probably could have cleaned up the grammar:
Quoted 1 line
https://lore.kernel.org/lkml/20210421135500.3518661-1-arnd at kernel.org/
Oh, that's fine. I just missed it. :(
thanks.
Signature · 1 line
~Randy
Quoted 73 lines · Randy Dunlap
Quoted 72 lines · Andrew Jeffery
Quoted 55 lines · Randy Dunlap
Fix build warnings for using "%x" to print
resource_size_tin 2 places.resource_size_tcan be either of u32 or u64. We have a special format "%pa" for printing aresource_size_t, which is the same as aphys_addr_t. SeeDocumentation/core-api/printk-formats.rst.CC
drivers/edac/aspeed_edac.o../drivers/edac/aspeed_edac.c: In function 'init_csrows':../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",
257 | dev_dbg(mci->pdev, "dt: /memory node resources: first page
r.start=0x%x, resource_size=0x%x,PAGE_SHIFTmacro=0x%x\n",Fixes 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")Signed-off-by Randy Dunlap <[email protected]>Reported-by kernel test robot <[email protected]>Cc Troy Lee <[email protected]>Cc Stefan Schaeckeler <[email protected]>Cc linux-edac at vger.kernel.orgCc Borislav Petkov <[email protected]>Cc Borislav Petkov <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Cc Tony Luck <[email protected]>Cc linux-aspeed at lists.ozlabs.org---
Found in linux-next but applies to mainline.drivers/edac/aspeed_edac.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/edac/aspeed_edac.c +1
-0@@ -234,6 +234,7 @@ static int init_csrows(struct mem_ctl_inu32 nr_pages, dram_type;struct dimm_info *dimm;struct device_node *np; +resource_size_t rsize;struct resource r;u32 reg04;int rc;drivers/edac/aspeed_edac.c static int init_csrows(struct mem_ctl_in · line 262
Quoted 10 lines
drivers/edac/aspeed_edac.c +3
-2@@ -254,11 +255,12 @@ static int init_csrows(struct mem_ctl_inreturn 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); + rsize = resource_size(&r); + dev_dbg(mci->pdev, "dt: /memory node resources: first page r.start=0x%pa, resource_size=0x%pa, PAGE_SHIFT macro=0x%x\n", + &r.start, &rsize,PAGE_SHIFT );Arnd posted a fix a few days back that feels more intuitive, though probably could have cleaned up the grammar:
Quoted 3 lines
Quoted 1 line
https://lore.kernel.org/lkml/20210421135500.3518661-1-arnd at kernel.org/
Oh, that's fine. I just missed it. :(
No worries, I was a bit short there as I was in a rush. I certainly don't expect you to go looking for Arnd's patch without knowing it exists :)
Andrew