public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] serial: 8250_gsc: fix printk format warning
@ 2009-05-18 13:11 Alexander Beregalov
  2009-05-28  5:51 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Beregalov @ 2009-05-18 13:11 UTC (permalink / raw)
  To: linux-parisc, linux-kernel, alan; +Cc: Alexander Beregalov

Fix this build warning:
drivers/serial/8250_gsc.c:44: warning: format '%lx' expects type
'long unsigned int', but argument 2 has type 'resource_size_t'

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
---
 drivers/serial/8250_gsc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c
index 418b4fe..a7b02a5 100644
--- a/drivers/serial/8250_gsc.c
+++ b/drivers/serial/8250_gsc.c
@@ -41,7 +41,7 @@ static int __init serial_init_chip(struct parisc_device *dev)
 			printk(KERN_INFO
 				"Serial: device 0x%lx not configured.\n"
 				"Enable support for Wax, Lasi, Asp or Dino.\n",
-				dev->hpa.start);
+				(unsigned long)dev->hpa.start);
 		return -ENODEV;
 	}
 
-- 
1.6.2.5


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

* Re: [PATCH 2/2] serial: 8250_gsc: fix printk format warning
  2009-05-18 13:11 [PATCH 2/2] serial: 8250_gsc: fix printk format warning Alexander Beregalov
@ 2009-05-28  5:51 ` Andrew Morton
  2009-05-29 15:51   ` Grant Grundler
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2009-05-28  5:51 UTC (permalink / raw)
  To: Alexander Beregalov; +Cc: linux-parisc, linux-kernel, alan

On Mon, 18 May 2009 17:11:31 +0400 Alexander Beregalov <a.beregalov@gmail.com> wrote:

> Fix this build warning:
> drivers/serial/8250_gsc.c:44: warning: format '%lx' expects type
> 'long unsigned int', but argument 2 has type 'resource_size_t'
> 

The patch does more than fix a "warning".  It fixes an actual error. 
The caller will prepare a 64-bit argument and the callee will print
only 32 bits of it.

> ---
>  drivers/serial/8250_gsc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c
> index 418b4fe..a7b02a5 100644
> --- a/drivers/serial/8250_gsc.c
> +++ b/drivers/serial/8250_gsc.c
> @@ -41,7 +41,7 @@ static int __init serial_init_chip(struct parisc_device *dev)
>  			printk(KERN_INFO
>  				"Serial: device 0x%lx not configured.\n"
>  				"Enable support for Wax, Lasi, Asp or Dino.\n",
> -				dev->hpa.start);
> +				(unsigned long)dev->hpa.start);

Nope.  hpa.start can be u32 or u64.  We need to cast that to the wider
type so that it will correctly print in all circumstances.

So I changed both patches to print with %ll and to cast to
unsigned long long.

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

* Re: [PATCH 2/2] serial: 8250_gsc: fix printk format warning
  2009-05-28  5:51 ` Andrew Morton
@ 2009-05-29 15:51   ` Grant Grundler
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Grundler @ 2009-05-29 15:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Alexander Beregalov, linux-parisc, linux-kernel, alan

On Wed, May 27, 2009 at 10:51:06PM -0700, Andrew Morton wrote:
> On Mon, 18 May 2009 17:11:31 +0400 Alexander Beregalov <a.beregalov@gmail.com> wrote:
> 
> > Fix this build warning:
> > drivers/serial/8250_gsc.c:44: warning: format '%lx' expects type
> > 'long unsigned int', but argument 2 has type 'resource_size_t'
> > 
> 
> The patch does more than fix a "warning".  It fixes an actual error. 
> The caller will prepare a 64-bit argument and the callee will print
> only 32 bits of it.

On parisc, AFAIK, GSC devices are always at a 32-bit addresses.
So whatever compiles clean is fine.

Please add "Reviewed by: Grant Grundler <grundler@parisc-linux.org>"

thanks,
grant

> > ---
> >  drivers/serial/8250_gsc.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c
> > index 418b4fe..a7b02a5 100644
> > --- a/drivers/serial/8250_gsc.c
> > +++ b/drivers/serial/8250_gsc.c
> > @@ -41,7 +41,7 @@ static int __init serial_init_chip(struct parisc_device *dev)
> >  			printk(KERN_INFO
> >  				"Serial: device 0x%lx not configured.\n"
> >  				"Enable support for Wax, Lasi, Asp or Dino.\n",
> > -				dev->hpa.start);
> > +				(unsigned long)dev->hpa.start);
> 
> Nope.  hpa.start can be u32 or u64.  We need to cast that to the wider
> type so that it will correctly print in all circumstances.
> 
> So I changed both patches to print with %ll and to cast to
> unsigned long long.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-05-29 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-18 13:11 [PATCH 2/2] serial: 8250_gsc: fix printk format warning Alexander Beregalov
2009-05-28  5:51 ` Andrew Morton
2009-05-29 15:51   ` Grant Grundler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox