public inbox for linux-iio@vger.kernel.org
 help / color / mirror / 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	[thread overview]
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	other threads:[~2019-08-15  8:59 UTC|newest]

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

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=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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox