public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Songjun Wu <songjun.wu@atmel.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Axel Lin <axel.lin@ingics.com>,
	Sergey Kiselev <sergey.kiselev@intel.com>,
	patches@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org,
	kernel-janitors@vger.kernel.org
Subject: [patch] ASoC: wm8731: harmless underflow in wm8731_put_deemph()
Date: Tue, 13 Oct 2015 07:08:57 +0000	[thread overview]
Message-ID: <20151013070857.GC31537@mwanda> (raw)

The code tries to verify that "deemph" is zero or one, but it fails to
account for that it can be negative.  It's harmless because negatives
are treated the same as one, but we should fix it just to silence the
static checker warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index ace8645..07cf1bd 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -132,7 +132,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
 	struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
-	int deemph = ucontrol->value.integer.value[0];
+	unsigned int deemph = ucontrol->value.integer.value[0];
 	int ret = 0;
 
 	if (deemph > 1)

             reply	other threads:[~2015-10-13  7:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13  7:08 Dan Carpenter [this message]
2015-10-13 12:27 ` [patch] ASoC: wm8731: harmless underflow in wm8731_put_deemph() Charles Keepax

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=20151013070857.GC31537@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=fabio.estevam@freescale.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=sergey.kiselev@intel.com \
    --cc=songjun.wu@atmel.com \
    --cc=tiwai@suse.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