diff mbox

[4/4] sh/kexec: Fix kexec build warning

Message ID 594a3d26aac66e9668edc81d7bfb4e801575514f.1386807069.git.geoff@infradead.org (mailing list archive)
State Superseded
Headers show

Commit Message

Geoff Levand Dec. 12, 2013, 12:18 a.m. UTC
Add a cast to a printk argument to suppress a type mismatch compiler warning.

Signed-off-by: Geoff Levand <geoff@infradead.org> for Huawei, Linaro
---
 arch/sh/kernel/machine_kexec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven Dec. 12, 2013, 2:48 p.m. UTC | #1
Hi Geoff,

On Thu, Dec 12, 2013 at 1:18 AM, Geoff Levand <geoff@infradead.org> wrote:
> Add a cast to a printk argument to suppress a type mismatch compiler warning.
>
> Signed-off-by: Geoff Levand <geoff@infradead.org> for Huawei, Linaro
> ---
>  arch/sh/kernel/machine_kexec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
> index 9fea49f..b7e65a8 100644
> --- a/arch/sh/kernel/machine_kexec.c
> +++ b/arch/sh/kernel/machine_kexec.c
> @@ -60,7 +60,7 @@ static void kexec_info(struct kimage *image)
>                        i,
>                        (unsigned int)image->segment[i].mem,
>                        (unsigned int)image->segment[i].mem +
> -                                    image->segment[i].memsz,
> +                      (unsigned int)image->segment[i].memsz,
>                        (unsigned int)image->segment[i].memsz);
>         }
>         printk("  start     : 0x%08x\n\n", (unsigned int)image->start);

Wouldn't it be better to remove all casts and correct the printf-style
format specifiers instead?

  - mem and start are unsigned long, hence use "0x%08lx",
  - memsz is size_t, hence use "0x%08zx".

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geoff Levand Dec. 12, 2013, 7:30 p.m. UTC | #2
Hi,

On Thu, 2013-12-12 at 15:48 +0100, Geert Uytterhoeven wrote:
> On Thu, Dec 12, 2013 at 1:18 AM, Geoff Levand <geoff@infradead.org> wrote:
> > -                                    image->segment[i].memsz,
> > +                      (unsigned int)image->segment[i].memsz,e->start);
> 
> Wouldn't it be better to remove all casts and correct the printf-style
> format specifiers instead?

That would be better, I'll make a new patch.

Thanks Geert!


--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
index 9fea49f..b7e65a8 100644
--- a/arch/sh/kernel/machine_kexec.c
+++ b/arch/sh/kernel/machine_kexec.c
@@ -60,7 +60,7 @@  static void kexec_info(struct kimage *image)
 		       i,
 		       (unsigned int)image->segment[i].mem,
 		       (unsigned int)image->segment[i].mem +
-				     image->segment[i].memsz,
+		       (unsigned int)image->segment[i].memsz,
 		       (unsigned int)image->segment[i].memsz);
 	}
 	printk("  start     : 0x%08x\n\n", (unsigned int)image->start);