linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] ASoC: max9867: fix type of variable containing error codes
@ 2016-02-23  6:45 Andrzej Hajda
  2016-02-23  6:50 ` Axel Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Andrzej Hajda @ 2016-02-23  6:45 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	anish kumar, Axel Lin,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

value variable can contain error values and is compared with zero.
Its type must be signed.

The problem has been detected using coccinelle script
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 sound/soc/codecs/max9867.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c
index ab7a94d..4fb6fc7 100755
--- a/sound/soc/codecs/max9867.c
+++ b/sound/soc/codecs/max9867.c
@@ -180,7 +180,8 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_codec *codec = dai->codec;
 	struct max9867_priv *max9867 = snd_soc_codec_get_drvdata(codec);
-	unsigned int ni_h, ni_l, value;
+	unsigned int ni_h, ni_l;
+	int value;
 
 	value = get_ni_value(max9867->sysclk, params_rate(params));
 	if (value < 0)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] ASoC: max9867: fix type of variable containing error codes
  2016-02-23  6:45 [PATCH 2/2] ASoC: max9867: fix type of variable containing error codes Andrzej Hajda
@ 2016-02-23  6:50 ` Axel Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Axel Lin @ 2016-02-23  6:50 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Liam Girdwood, Mark Brown, Bartlomiej Zolnierkiewicz,
	Marek Szyprowski, anish kumar,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

2016-02-23 14:45 GMT+08:00 Andrzej Hajda <a.hajda@samsung.com>:
> value variable can contain error values and is compared with zero.
> Its type must be signed.
Reviewed-by: Axel Lin <axel.lin@ingics.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-23  6:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-23  6:45 [PATCH 2/2] ASoC: max9867: fix type of variable containing error codes Andrzej Hajda
2016-02-23  6:50 ` Axel Lin

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).