The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: AS50 CTLin0 <ctlin0@nuvoton.com>
To: Tom Rix <trix@redhat.com>,
	lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, nathan@kernel.org, ndesaulniers@google.com,
	luca.ceresoli@bootlin.com, peda@axentia.se, javierm@redhat.com,
	u.kleine-koenig@pengutronix.de, ckeepax@opensource.cirrus.com
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH] ASoC: nau8825: fix bounds check for adc_delay
Date: Tue, 18 Apr 2023 20:23:33 +0800	[thread overview]
Message-ID: <0fcf5bb1-938b-64dd-d76a-e8f819acb9cb@nuvoton.com> (raw)
In-Reply-To: <20230418120955.3230705-1-trix@redhat.com>

On 4/18/2023 8:09 PM, Tom Rix wrote:
> clang build reports
> sound/soc/codecs/nau8825.c:2826:31: error: overlapping comparisons
>    always evaluate to false [-Werror,-Wtautological-overlap-compare]
>          if (nau8825->adc_delay < 125 && nau8825->adc_delay > 500)
>              ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This is a bug, a logical-or should have been used.
>
> Fixes: fc0b096c9291 ("ASoC: nau8825: Add delay control for input path")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   sound/soc/codecs/nau8825.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
> index c4389f5fe603..f4eb999761a4 100644
> --- a/sound/soc/codecs/nau8825.c
> +++ b/sound/soc/codecs/nau8825.c
> @@ -2823,7 +2823,7 @@ static int nau8825_read_device_properties(struct device *dev,
>       ret = device_property_read_u32(dev, "nuvoton,adc-delay-ms", &nau8825->adc_delay);
>       if (ret)
>               nau8825->adc_delay = 125;
> -     if (nau8825->adc_delay < 125 && nau8825->adc_delay > 500)
> +     if (nau8825->adc_delay < 125 || nau8825->adc_delay > 500)
>               dev_warn(dev, "Please set the suitable delay time!\n");
>
>       nau8825->mclk = devm_clk_get(dev, "mclk");

Sorry, it is my fault. You are right.

Acked-by: David Lin <CTLIN0@nuvoton.com>

________________________________
________________________________
 The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.

  reply	other threads:[~2023-04-18 12:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 12:09 [PATCH] ASoC: nau8825: fix bounds check for adc_delay Tom Rix
2023-04-18 12:23 ` AS50 CTLin0 [this message]
2023-04-18 16:21 ` 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=0fcf5bb1-938b-64dd-d76a-e8f819acb9cb@nuvoton.com \
    --to=ctlin0@nuvoton.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=javierm@redhat.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=luca.ceresoli@bootlin.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peda@axentia.se \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=trix@redhat.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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