public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ad7768-1: Remove logically dead code
@ 2025-08-16 13:37 Chandra Mohan Sundar
  2025-08-17 14:32 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Chandra Mohan Sundar @ 2025-08-16 13:37 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23, dlechner, nuno.sa, andy,
	linux-iio, shuah
  Cc: Chandra Mohan Sundar, linux-kernel-mentees

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")
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 */
-- 
2.43.0


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

end of thread, other threads:[~2025-08-17 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-16 13:37 [PATCH] iio: adc: ad7768-1: Remove logically dead code Chandra Mohan Sundar
2025-08-17 14:32 ` Jonathan Cameron
2025-08-17 16:25   ` Chandra Mohan Sundar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox