public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH] ASoC: codecs: Fix unsigned comparison with less than zero
Date: Mon, 6 Feb 2023 09:30:26 +0100	[thread overview]
Message-ID: <20230206093026.6236eea2@bootlin.com> (raw)
In-Reply-To: <20230206075518.84169-1-jiapeng.chong@linux.alibaba.com>

On Mon,  6 Feb 2023 15:55:18 +0800
Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:

> The val is defined as unsigned int type, if(val<0) is redundant, so
> delete it.
> 
> sound/soc/codecs/idt821034.c:449 idt821034_kctrl_gain_put() warn: unsigned 'val' is never less than zero.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3947
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  sound/soc/codecs/idt821034.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/idt821034.c b/sound/soc/codecs/idt821034.c
> index 5d01787b1c1f..2cc7b9166e69 100644
> --- a/sound/soc/codecs/idt821034.c
> +++ b/sound/soc/codecs/idt821034.c
> @@ -446,8 +446,6 @@ static int idt821034_kctrl_gain_put(struct snd_kcontrol *kcontrol,
>  	u8 ch;
>  
>  	val = ucontrol->value.integer.value[0];
> -	if (val < 0)
> -		return -EINVAL;
>  	if (val > max - min)
>  		return -EINVAL;
>  

Acked-by: Herve Codina <herve.codina@bootlin.com>

Thanks,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2023-02-06  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06  7:55 [PATCH] ASoC: codecs: Fix unsigned comparison with less than zero Jiapeng Chong
2023-02-06  8:30 ` Herve Codina [this message]
2023-02-06 14:36 ` 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=20230206093026.6236eea2@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=abaci@linux.alibaba.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --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