Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: alexandru.ardelean@analog.com
Cc: linux-iio@vger.kernel.org
Subject: [bug report] iio: imu: Add support for the ADIS16460 IMU
Date: Thu, 15 Aug 2019 11:59:22 +0300
Message-ID: <20190815085922.GA1025@mwanda> (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

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically 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=20190815085922.GA1025@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=linux-iio@vger.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

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org linux-iio@archiver.kernel.org
	public-inbox-index linux-iio


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/ public-inbox