All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thibaut Robert <thibaut.robert@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tc: fix warning and coding style
Date: Tue, 30 Sep 2014 15:51:23 +0200	[thread overview]
Message-ID: <1412085083.10205.8.camel@L80496> (raw)
In-Reply-To: <CAMuHMdXj=b0G7foTRkcEtRC_De8+WjVefxBfW=s1sjaXLeF5nQ@mail.gmail.com>

Hi Geert,

Le mardi 30 septembre 2014 à 14:28 +0200, Geert Uytterhoeven a écrit :
> Hi Thibaut,
> 
> On Tue, Sep 30, 2014 at 2:16 PM, Thibaut Robert
> <thibaut.robert@gmail.com> wrote:
> > Fix gcc warning:
> > warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘resource_size_t’ [-Wformat=]
> >
> > As resource_size_t can be 32 or 64 bits (depending on CONFIG_RESOURCES_64BIT), this patch uses "%lld" format along with a cast to u64 for printing resource_size_t values
> 
> Please use %pR instead (cfr. Documentation/printk-formats.txt).

This code use 'resource_size_t' but I think %pR is for 'struct resource'. I got inspired by this patch: https://lkml.org/lkml/2008/8/29/187 

However, I've thought again, and '%u' is probably enough for displaying a size in MiB. So I propose the following :
(Parens around the cast were also missing in my first patch):

@@ -117,10 +114,10 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus)
 			tdev->resource.start = extslotaddr;
 			tdev->resource.end = extslotaddr + devsize - 1;
 		} else {
-			printk(KERN_ERR "%s: Cannot provide slot space "
-			       "(%dMiB required, up to %dMiB supported)\n",
-			       dev_name(&tdev->dev), devsize >> 20,
-			       max(slotsize, extslotsize) >> 20);
+			dev_err(&tdev->dev,
+				"Cannot provide slot space (%uMiB required, up to %uMiB supported)\n",
+				(unsigned int) (devsize >> 20),
+				(unsigned int) (max(slotsize, extslotsize) >> 20));
 			kfree(tdev);
 			goto out_err;
 		}


WDYT ?

Thibaut

  reply	other threads:[~2014-09-30 13:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 12:16 [PATCH] tc: fix warning and coding style Thibaut Robert
2014-09-30 12:28 ` Geert Uytterhoeven
2014-09-30 13:51   ` Thibaut Robert [this message]
2014-09-30 14:08     ` Geert Uytterhoeven
2014-09-30 14:31       ` Thibaut Robert
2014-09-30 16:28 ` 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=1412085083.10205.8.camel@L80496 \
    --to=thibaut.robert@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=ralf@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.