linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mtd/maps: fix solutionengine.c printk format warnings
@ 2018-07-22 23:28 Randy Dunlap
  2018-07-24  5:49 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Randy Dunlap @ 2018-07-22 23:28 UTC (permalink / raw)
  To: LKML, Linux-sh list
  Cc: David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
	Richard Weinberger, linux-mtd, Yoshinori Sato, Rich Felker,
	Sergei Shtylyov

From: Randy Dunlap <rdunlap@infradead.org>

Fix 2 printk format warnings (this driver is currently only used by
arch/sh/) by using "%pap" instead of "%lx".
(or we could just cast the physical addresses to unsigned int)

Fixes these build warnings:

../drivers/mtd/maps/solutionengine.c: In function 'init_soleng_maps':
../include/linux/kern_levels.h:5:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
../drivers/mtd/maps/solutionengine.c:62:54: note: format string is defined here
  printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
                                                  ~~~~^
                                                  %08x
../include/linux/kern_levels.h:5:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
../drivers/mtd/maps/solutionengine.c:62:72: note: format string is defined here
  printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
                                                                    ~~~~^
                                                                    %08x

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
v2: indent all lines inside the new block

 drivers/mtd/maps/solutionengine.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--- linux-next-20180717.orig/drivers/mtd/maps/solutionengine.c
+++ linux-next-20180717/drivers/mtd/maps/solutionengine.c
@@ -59,9 +59,14 @@ static int __init init_soleng_maps(void)
 			return -ENXIO;
 		}
 	}
-	printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
-	       soleng_flash_map.phys & 0x1fffffff,
-	       soleng_eprom_map.phys & 0x1fffffff);
+	{
+		resource_size_t fl_phys = soleng_flash_map.phys & 0x1fffffff;
+		resource_size_t ep_phys = soleng_eprom_map.phys & 0x1fffffff;
+
+		printk(KERN_NOTICE
+		       "Solution Engine: Flash at 0x%pap, EPROM at 0x%pap\n",
+	       	       &fl_phys, &ep_phys);
+	}
 	flash_mtd->owner = THIS_MODULE;
 
 	eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);



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

* Re: [PATCH v2] mtd/maps: fix solutionengine.c printk format warnings
  2018-07-22 23:28 [PATCH v2] mtd/maps: fix solutionengine.c printk format warnings Randy Dunlap
@ 2018-07-24  5:49 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2018-07-24  5:49 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: LKML, Linux-sh list, David Woodhouse, Brian Norris, Marek Vasut,
	Richard Weinberger, linux-mtd, Yoshinori Sato, Rich Felker,
	Sergei Shtylyov

On Sun, 22 Jul 2018 16:28:52 -0700
Randy Dunlap <rdunlap@infradead.org> wrote:

> From: Randy Dunlap <rdunlap@infradead.org>
> 
> Fix 2 printk format warnings (this driver is currently only used by
> arch/sh/) by using "%pap" instead of "%lx".
> (or we could just cast the physical addresses to unsigned int)
> 
> Fixes these build warnings:
> 
> ../drivers/mtd/maps/solutionengine.c: In function 'init_soleng_maps':
> ../include/linux/kern_levels.h:5:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
> ../drivers/mtd/maps/solutionengine.c:62:54: note: format string is defined here
>   printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
>                                                   ~~~~^
>                                                   %08x
> ../include/linux/kern_levels.h:5:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
> ../drivers/mtd/maps/solutionengine.c:62:72: note: format string is defined here
>   printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
>                                                                     ~~~~^
>                                                                     %08x
> 
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Brian Norris <computersforpeace@gmail.com>
> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Richard Weinberger <richard@nod.at>
> Cc: linux-mtd@lists.infradead.org
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Cc: linux-sh@vger.kernel.org
> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> ---
> v2: indent all lines inside the new block
> 
>  drivers/mtd/maps/solutionengine.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> --- linux-next-20180717.orig/drivers/mtd/maps/solutionengine.c
> +++ linux-next-20180717/drivers/mtd/maps/solutionengine.c
> @@ -59,9 +59,14 @@ static int __init init_soleng_maps(void)
>  			return -ENXIO;
>  		}
>  	}
> -	printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
> -	       soleng_flash_map.phys & 0x1fffffff,
> -	       soleng_eprom_map.phys & 0x1fffffff);

Hm, not sure why masking with 0x1fffffff is required. It seems .phys is
either 0 or 0x1000000, so maybe we should just go for 

	printk(KERN_NOTICE "Solution Engine: Flash at 0x%pap, EPROM at 0x%pap\n",
	       &soleng_flash_map.phys, &soleng_eprom_map.phys);


> +	{
> +		resource_size_t fl_phys = soleng_flash_map.phys & 0x1fffffff;
> +		resource_size_t ep_phys = soleng_eprom_map.phys & 0x1fffffff;
> +
> +		printk(KERN_NOTICE
> +		       "Solution Engine: Flash at 0x%pap, EPROM at 0x%pap\n",
> +	       	       &fl_phys, &ep_phys);
> +	}
>  	flash_mtd->owner = THIS_MODULE;
>  
>  	eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);
> 
> 


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

end of thread, other threads:[~2018-07-24  5:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-22 23:28 [PATCH v2] mtd/maps: fix solutionengine.c printk format warnings Randy Dunlap
2018-07-24  5:49 ` Boris Brezillon

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