netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] declance: Fix 64-bit compilation warnings
Date: Sat, 28 Jun 2014 16:06:58 -0700	[thread overview]
Message-ID: <1403996818.9064.48.camel@joe-AO725> (raw)
In-Reply-To: <alpine.LFD.2.11.1406282329040.15455@eddie.linux-mips.org>

On Sat, 2014-06-28 at 23:57 +0100, Maciej W. Rozycki wrote:
> This fixes compiler warnings:
> 
> drivers/net/ethernet/amd/declance.c: In function 'lance_init_ring':
> drivers/net/ethernet/amd/declance.c:478: warning: format '%8.8x' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
> drivers/net/ethernet/amd/declance.c:487: warning: format '%8.8x' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
> drivers/net/ethernet/amd/declance.c:503: warning: cast from pointer to integer of different size
> drivers/net/ethernet/amd/declance.c:520: warning: cast from pointer to integer of different size
> 
> in 64-bit compilation.  Where the value printed is an offset (whose range 
> will always fit) the cast uses a 32-bit type, otherwise, where it is a 
> host memory address, the `long' type is used and the width of the number 
> printed adjusted according to the size of this type.
> 
> Tested with both 32-bit and 64-bit compilation, as well as at the run time 
> (with the debug messages affected enabled).
[]
> Index: net-next-20140424-4maxp64/drivers/net/ethernet/amd/declance.c
[]
> @@ -499,8 +499,9 @@ static void lance_init_ring(struct net_d
>  						/* The ones required by tmd2 */
>  		*lib_ptr(ib, btx_ring[i].misc, lp->type) = 0;
>  		if (i < 3 && ZERO)
> -			printk("%d: 0x%8.8x(0x%8.8x)\n",
> -			       i, leptr, (uint)lp->tx_buf_ptr_cpu[i]);
> +			printk("%d: 0x%8.8x(%#0*lx)\n",
> +			       i, leptr, (int)sizeof(long),
> +			       (long)lp->tx_buf_ptr_cpu[i]);

You need to adjust the "*" and sizeof(long) with +2 for the
0x prefix in the output length here.

  reply	other threads:[~2014-06-28 23:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-28 22:57 [PATCH] declance: Fix 64-bit compilation warnings Maciej W. Rozycki
2014-06-28 23:06 ` Joe Perches [this message]
2014-06-29  1:30   ` Maciej W. Rozycki
2014-06-30  9:44   ` David Laight
2014-06-30  9:58     ` Maciej W. Rozycki

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=1403996818.9064.48.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=macro@linux-mips.org \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).