linux-mips
[Top] [All Lists]

Re: [PATCH] fix some compiler warnings (field width, unused variable)

To: geert@linux-m68k.org
Subject: Re: [PATCH] fix some compiler warnings (field width, unused variable)
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Fri, 02 Jun 2006 01:54:04 +0900 (JST)
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
In-reply-to: <Pine.LNX.4.62.0605311840170.18323@chinchilla.sonytel.be>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20060601.010003.39154219.anemo@mba.ocn.ne.jp> <Pine.LNX.4.62.0605311840170.18323@chinchilla.sonytel.be>
Sender: linux-mips-bounce@linux-mips.org
On Wed, 31 May 2006 18:47:54 +0200 (CEST), Geert Uytterhoeven 
<geert@linux-m68k.org> wrote:
> >                     printk("initrd extends beyond end of memory "
> >                            "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n",
> 
> `%L' is obsolete for long long, use `%ll' instead.
> 
> > -                          sizeof(long) * 2,
> > +                          (int)(sizeof(long) * 2),
> >                            (unsigned long long)CPHYSADDR(initrd_end),
> 
> As CPHYSADDR() returns a ptrdiff_t, what about using `%t' instead?
> Ah, that one doesn't print hex (hmm, C99 doesn't seem to tell).
> 
> You can cast to `void *' and use `%p' to get hex, and the field width will
> automagically be `2*sizeof(void *)', according to lib/vsprintf.c.

Thanks.  Though Ralf already committed it with slight changes, this
patch will make kernel just a bit smaller.


[MIPS] simplify printk format string (use %p instead of %0*Lx)

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 397a70e..4ab4bd5 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -420,18 +420,15 @@ static inline void bootmem_init(void)
        if (initrd_start) {
                unsigned long initrd_size = ((unsigned char *)initrd_end) -
                        ((unsigned char *)initrd_start);
-               const int width = sizeof(long) * 2;
 
                printk("Initial ramdisk at: 0x%p (%lu bytes)\n",
                       (void *)initrd_start, initrd_size);
 
                if (CPHYSADDR(initrd_end) > PFN_PHYS(max_low_pfn)) {
                        printk("initrd extends beyond end of memory "
-                              "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n",
-                              width,
-                              (unsigned long long) CPHYSADDR(initrd_end),
-                              width,
-                              (unsigned long long) PFN_PHYS(max_low_pfn));
+                              "(0x%p > 0x%p)\ndisabling initrd\n",
+                              (void *)CPHYSADDR(initrd_end),
+                              (void *)PFN_PHYS(max_low_pfn));
                        initrd_start = initrd_end = 0;
                        initrd_reserve_bootmem = 0;
                }

<Prev in Thread] Current Thread [Next in Thread>