linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: imu: adis16480: clean up a condition
@ 2019-09-26  8:10 Dan Carpenter
  2019-09-26 11:06 ` Ardelean, Alexandru
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2019-09-26  8:10 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Michael Hennerich, Stefan Popa, Jonathan Cameron, Hartmut Knaack,
	Peter Meerwald-Stadler, linux-iio, linux-kernel, kernel-janitors

The "t" variable is unsigned so it can't be less than zero.  We really
are just trying to prevent divide by zero bugs so just checking against
zero is sufficient.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/iio/imu/adis16480.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
index b99d73887c9f..e144e567675d 100644
--- a/drivers/iio/imu/adis16480.c
+++ b/drivers/iio/imu/adis16480.c
@@ -318,7 +318,7 @@ static int adis16480_set_freq(struct iio_dev *indio_dev, int val, int val2)
 	unsigned int t, reg;
 
 	t =  val * 1000 + val2 / 1000;
-	if (t <= 0)
+	if (t == 0)
 		return -EINVAL;
 
 	/*
-- 
2.20.1


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

end of thread, other threads:[~2019-10-07 14:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26  8:10 [PATCH] iio: imu: adis16480: clean up a condition Dan Carpenter
2019-09-26 11:06 ` Ardelean, Alexandru
2019-09-26 11:36   ` Dan Carpenter
2019-10-06  8:51     ` Jonathan Cameron
2019-10-06 18:14       ` Dan Carpenter
2019-10-07  9:21         ` Jonathan Cameron
2019-10-07 14:18           ` Dan Carpenter

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