Skip to contentSkip to conversation

iio: imu: Add support for the ADIS16460 IMU

bug report Dan Carpenter 1 participant 1 message Aug 15, 2019 IIO

lore
Share & tools
lore
#0 lore raw

Hello Alexandru Ardelean,

The patch db6ed4d23dd1: "iio: imu: Add support for the ADIS16460 IMU" from Jul 23, 2019, leads to the following static checker warning:

	drivers/iio/imu/adis16460.c:158 adis16460_set_freq()
	warn: 't' unsigned <= 0

drivers/iio/imu/adis16460.c
152 static int adis16460_set_freq(struct iio_dev *indio_dev, int val, int val2) 153 {
154 struct adis16460 *st = iio_priv(indio_dev);

   155          unsigned int t;
                ^^^^^^^^^^^^^^

156
157 t = val * 1000 + val2 / 1000;
158 if (t <= 0)

                    ^^^^^^

Unsigned is not less than zero.

   159                  return -EINVAL;
   160  
   161          t = 2048000 / t;
   162          if (t > 2048)
   163                  t = 2048;
   164  
   165          if (t != 0)
   166                  t--;
   167  
   168          return adis_write_reg_16(&st->adis, ADIS16460_REG_DEC_RATE, t);
   169  }

regards,
dan carpenter