From: Nathan Chancellor <natechancellor@gmail.com>
To: Shuming Fan <shumingf@realtek.com>, Mark Brown <broonie@kernel.org>
Cc: Bard Liao <bardliao@realtek.com>,
Oder Chiou <oder_chiou@realtek.com>,
Liam Girdwood <lgirdwood@gmail.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Nick Desaulniers <ndesaulniers@google.com>,
clang-built-linux@googlegroups.com,
Nathan Chancellor <natechancellor@gmail.com>
Subject: [PATCH] ASoC: rt1011: Mark format integer literals as unsigned
Date: Wed, 5 Jun 2019 22:12:27 -0700 [thread overview]
Message-ID: <20190606051227.90944-1-natechancellor@gmail.com> (raw)
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 */
^
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.
Fixes: d6e65bb7ff0d ("ASoC: rt1011: Add RT1011 amplifier driver")
Link: https://github.com/ClangBuiltLinux/linux/issues/506
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
sound/soc/codecs/rt1011.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt1011.c b/sound/soc/codecs/rt1011.c
index 349d6db7ecd4..3a0ae80c5ee0 100644
--- a/sound/soc/codecs/rt1011.c
+++ b/sound/soc/codecs/rt1011.c
@@ -1288,7 +1288,7 @@ static int rt1011_r0_load_mode_put(struct snd_kcontrol *kcontrol,
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
rt1011->r0_reg = ucontrol->value.integer.value[0];
- format = 2147483648; /* 2^24 * 128 */
+ format = 2147483648U; /* 2^24 * 128 */
r0_integer = format / rt1011->r0_reg / 128;
r0_factor = ((format / rt1011->r0_reg * 100) / 128)
- (r0_integer * 100);
@@ -2120,7 +2120,7 @@ static int rt1011_calibrate(struct rt1011_priv *rt1011, unsigned char cali_flag)
dev_err(dev, "Calibrate R0 Failure\n");
ret = -EAGAIN;
} else {
- format = 2147483648; /* 2^24 * 128 */
+ format = 2147483648U; /* 2^24 * 128 */
r0_integer = format / r0[0] / 128;
r0_factor = ((format / r0[0] * 100) / 128)
- (r0_integer * 100);
--
2.22.0.rc3
next reply other threads:[~2019-06-06 5:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 5:12 Nathan Chancellor [this message]
2019-06-06 18:50 ` [PATCH] ASoC: rt1011: Mark format integer literals as unsigned Nick Desaulniers
2019-06-06 20:09 ` Nathan Chancellor
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=20190606051227.90944-1-natechancellor@gmail.com \
--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).