alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Shuming Fan <shumingf@realtek.com>,
	Mark Brown <broonie@kernel.org>, Bard Liao <bardliao@realtek.com>,
	Oder Chiou <oder_chiou@realtek.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	alsa-devel@alsa-project.org, LKML <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH] ASoC: rt1011: Mark format integer literals as unsigned
Date: Thu, 6 Jun 2019 13:09:19 -0700	[thread overview]
Message-ID: <20190606200919.GA12912@archlinux-epyc> (raw)
In-Reply-To: <CAKwvOdnswiifrvSrBcAnc4Br8nhxJRUAL0yNM6T6=4xScHXf5g@mail.gmail.com>

On Thu, Jun 06, 2019 at 11:50:10AM -0700, Nick Desaulniers wrote:
> On Wed, Jun 5, 2019 at 10:13 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > Clang warns:
> >
> > sound/soc/codecs/rt1011.c:1291:12: warning: integer literal is too large
> > to be represented in type 'long', interpreting as 'unsigned long' per
> > C89; this literal will have type 'long long' in C99 onwards
> > [-Wc99-compat]
> >                 format = 2147483648; /* 2^24 * 128 */
> 
> This number's bitpattern is a leading one followed by 31 zeros.
> `format` is declared as `unsigned int`, and literals in C are signed
> unless suffixed, so this patch LGTM.  Maybe a macro declaring such a
> bitpattern would improve readability over the existing magic constant
> and comment?

I thought about it but that is ultimately up to the maintainer I think.

> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> 
> >                          ^
> > sound/soc/codecs/rt1011.c:2123:13: warning: integer literal is too large
> > to be represented in type 'long', interpreting as 'unsigned long' per
> > C89; this literal will have type 'long long' in C99 onwards
> > [-Wc99-compat]
> >                         format = 2147483648; /* 2^24 * 128 */
> >                                  ^
> > 2 warnings generated.
> >
> > Mark the integer literals as unsigned explicitly so that if the kernel
> > does ever bump the C standard it uses, the behavior is consitent.
> 
> s/consitent/consistent/
> 
> :set spell

Grr... I can send a v2 unless the maintainer wants to manually fix it
up. Thank you for the review as always.

Nathan

  reply	other threads:[~2019-06-06 20:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06  5:12 [PATCH] ASoC: rt1011: Mark format integer literals as unsigned Nathan Chancellor
2019-06-06 18:50 ` Nick Desaulniers
2019-06-06 20:09   ` Nathan Chancellor [this message]
2019-06-06 21:27 ` Applied "ASoC: rt1011: Mark format integer literals as unsigned" to the asoc tree Mark Brown

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=20190606200919.GA12912@archlinux-epyc \
    --to=natechancellor@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bardliao@realtek.com \
    --cc=broonie@kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=oder_chiou@realtek.com \
    --cc=shumingf@realtek.com \
    /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).