public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alexander Beregalov <a.beregalov@gmail.com>
Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
	alan@lxorguk.ukuu.org.uk
Subject: Re: [PATCH 2/2] serial: 8250_gsc: fix printk format warning
Date: Wed, 27 May 2009 22:51:06 -0700	[thread overview]
Message-ID: <20090527225106.10fc9cc6.akpm@linux-foundation.org> (raw)
In-Reply-To: <1242652291-1868-1-git-send-email-a.beregalov@gmail.com>

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.

  reply	other threads:[~2009-05-28  5:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18 13:11 [PATCH 2/2] serial: 8250_gsc: fix printk format warning Alexander Beregalov
2009-05-28  5:51 ` Andrew Morton [this message]
2009-05-29 15:51   ` Grant Grundler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090527225106.10fc9cc6.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.beregalov@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox