From: Brian Norris <computersforpeace@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Boris BREZILLON <boris.brezillon@free-electrons.com>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: nand: Use ULL-suffix for big u64 constant
Date: Mon, 11 Aug 2014 10:50:36 -0700 [thread overview]
Message-ID: <20140811175036.GU3711@ld-irv-0074> (raw)
In-Reply-To: <1407604073-7484-1-git-send-email-geert@linux-m68k.org>
On Sat, Aug 09, 2014 at 07:07:53PM +0200, Geert Uytterhoeven wrote:
> drivers/mtd/nand/nand_timings.c:45: warning: integer constant is too large for ‘long’ type
On what compiler / static analyzer?
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> drivers/mtd/nand/nand_timings.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/nand_timings.c b/drivers/mtd/nand/nand_timings.c
> index 8b36253420fa..e81470a8ac67 100644
> --- a/drivers/mtd/nand/nand_timings.c
> +++ b/drivers/mtd/nand/nand_timings.c
> @@ -42,7 +42,7 @@ static const struct nand_sdr_timings onfi_sdr_timings[] = {
> .tRHZ_max = 200000,
> .tRLOH_min = 0,
> .tRP_min = 50000,
> - .tRST_max = 250000000000,
> + .tRST_max = 250000000000ULL,
See [1] and [2]. I'm pretty sure it is a bug in your tool to warn about
this. The C standard seems pretty clear that the large literal constant
is automatically promoted to a sufficiently large type, so AIUI there
should be no need for such a warning. A standards-compliant compiler
will do the right thing.
It really seems like this type of warning is only appropriate where a
smaller literal constant is immediately operated on such that it will
overflow. e.g.:
.tRST_max = 250 * 1000 * 1000 * 1000,
But this usually results in a different type of (correct) warning, like:
warning: integer overflow in expression [-Woverflow]
However, I could be convinced to apply this, if only to satisfy broken
tools and to avoid addressing this question over and over...
> .tWB_max = 200000,
> .tRR_min = 40000,
> .tWC_min = 100000,
Brian
[1] http://lists.infradead.org/pipermail/linux-mtd/2014-July/054750.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-April/252494.html
next prev parent reply other threads:[~2014-08-11 17:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-09 17:07 [PATCH] mtd: nand: Use ULL-suffix for big u64 constant Geert Uytterhoeven
2014-08-11 17:50 ` Brian Norris [this message]
2014-08-11 18:51 ` Geert Uytterhoeven
2014-08-11 19:06 ` Brian Norris
2014-08-11 19:25 ` Geert Uytterhoeven
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=20140811175036.GU3711@ld-irv-0074 \
--to=computersforpeace@gmail.com \
--cc=boris.brezillon@free-electrons.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.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