All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Chandra Mohan Sundar <chandramohan.explore@gmail.com>
Cc: lars@metafoo.de, Michael.Hennerich@analog.com,
	dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	linux-iio@vger.kernel.org, shuah@kernel.org,
	linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] iio: adc: ad7768-1: Remove logically dead code
Date: Sun, 17 Aug 2025 15:32:09 +0100	[thread overview]
Message-ID: <20250817153209.560334f5@jic23-huawei> (raw)
In-Reply-To: <20250816133757.98624-1-chandramohan.explore@gmail.com>

On Sat, 16 Aug 2025 19:07:55 +0530
Chandra Mohan Sundar <chandramohan.explore@gmail.com> wrote:

> The clamp macro returns a value within the specified range.
> 
> In ad7768_set_freq(), the value returned from clamp() is checked against
> zero, which is not possible since the value would always be between
> 50 and 1024000.
> 
> Removed the 'if' check.
> 
> This issue was reported by static coverity analyser as logically
> dead code.
> 
> Fixes: fb1d3b24ebf5c ("iio: adc: ad7768-1: add filter type and oversampling ratio attributes")
Applied but dropped the fixes tag. No need to encourage people to backport
this.

Jonathan

> Signed-off-by: Chandra Mohan Sundar <chandramohan.explore@gmail.com>
> ---
>  drivers/iio/adc/ad7768-1.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
> index ca8fa91796ca..a27591bbf7df 100644
> --- a/drivers/iio/adc/ad7768-1.c
> +++ b/drivers/iio/adc/ad7768-1.c
> @@ -687,8 +687,6 @@ static int ad7768_set_freq(struct ad7768_state *st,
>  	int ret;
>  
>  	freq = clamp(freq, 50, 1024000);
> -	if (freq == 0)
> -		return -EINVAL;
>  
>  	mclk_div = DIV_ROUND_CLOSEST(st->mclk_freq, freq * st->oversampling_ratio);
>  	/* Find the closest match for the desired sampling frequency */


  reply	other threads:[~2025-08-17 14:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-16 13:37 [PATCH] iio: adc: ad7768-1: Remove logically dead code Chandra Mohan Sundar
2025-08-17 14:32 ` Jonathan Cameron [this message]
2025-08-17 16:25   ` Chandra Mohan Sundar

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=20250817153209.560334f5@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=chandramohan.explore@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=nuno.sa@analog.com \
    --cc=shuah@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.