linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Martin Kepplinger <martink@posteo.de>
Cc: knaack.h@gmx.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: accel: mma8452: define unsigned return values where appropriate
Date: Sun, 27 Nov 2016 11:25:08 +0000	[thread overview]
Message-ID: <c33b72b4-aaf3-da11-1cda-601f7a4f7d55@kernel.org> (raw)
In-Reply-To: <1479758034-19220-1-git-send-email-martink@posteo.de>

On 21/11/16 19:53, Martin Kepplinger wrote:
> smatch warned:
> 	sval_binop_signed: invalid divide LLONG_MIN/-1
> 
> and this fixes it. It's actually good to have, in order to avoid accidental
> checking for negative return values here.
> 
> Signed-off-by: Martin Kepplinger <martink@posteo.de>
I'm assuming the nasty case doesn't actually occur so applied to the togreg branch of iio.git
and pushed out as testing for the autobuilders to play with it.

thanks,

Jonathan
> ---
>  drivers/iio/accel/mma8452.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 0e865a1..fba146f 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -248,7 +248,7 @@ static int mma8452_get_int_plus_micros_index(const int (*vals)[2], int n,
>  	return -EINVAL;
>  }
>  
> -static int mma8452_get_odr_index(struct mma8452_data *data)
> +static unsigned int mma8452_get_odr_index(struct mma8452_data *data)
>  {
>  	return (data->ctrl_reg1 & MMA8452_CTRL_DR_MASK) >>
>  			MMA8452_CTRL_DR_SHIFT;
> @@ -260,7 +260,7 @@ static const int mma8452_samp_freq[8][2] = {
>  };
>  
>  /* Datasheet table: step time "Relationship with the ODR" (sample frequency) */
> -static const int mma8452_transient_time_step_us[4][8] = {
> +static const unsigned int mma8452_transient_time_step_us[4][8] = {
>  	{ 1250, 2500, 5000, 10000, 20000, 20000, 20000, 20000 },  /* normal */
>  	{ 1250, 2500, 5000, 10000, 20000, 80000, 80000, 80000 },  /* l p l n */
>  	{ 1250, 2500, 2500, 2500, 2500, 2500, 2500, 2500 },	  /* high res*/
> 

      reply	other threads:[~2016-11-27 11:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 19:53 [PATCH] iio: accel: mma8452: define unsigned return values where appropriate Martin Kepplinger
2016-11-27 11:25 ` Jonathan Cameron [this message]

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=c33b72b4-aaf3-da11-1cda-601f7a4f7d55@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martink@posteo.de \
    --cc=pmeerw@pmeerw.net \
    /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;
as well as URLs for NNTP newsgroup(s).