linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-iio@vger.kernel.org, lorenzo.bianconi@redhat.com
Subject: Re: [PATCH] iio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable
Date: Fri, 14 Feb 2020 14:17:15 +0000	[thread overview]
Message-ID: <20200214141715.73ec5f52@archlinux> (raw)
In-Reply-To: <f0f53dbfdb2c638f8ebb3deca4576886625fa6e8.1581078931.git.lorenzo@kernel.org>

On Fri,  7 Feb 2020 13:37:54 +0100
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

> Add missing return value check in st_lsm6dsx_shub_read_oneshot disabling
> the slave device connected to the st_lsm6dsx i2c controller.
> The issue is reported by coverity with the following error:
> 
> Unchecked return value:
> If the function returns an error value, the error value may be mistaken
> for a normal value.
> 
> Addresses-Coverity-ID: 1456767 ("Unchecked return value")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Applied to the togreg branch of iio.git and pushed out as testing.
Thanks,

Jonathan

> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> index eea555617d4a..95ddd19d1aa7 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> @@ -464,9 +464,10 @@ st_lsm6dsx_shub_read_oneshot(struct st_lsm6dsx_sensor *sensor,
>  
>  	len = min_t(int, sizeof(data), ch->scan_type.realbits >> 3);
>  	err = st_lsm6dsx_shub_read(sensor, ch->address, data, len);
> +	if (err < 0)
> +		return err;
>  
> -	st_lsm6dsx_shub_set_enable(sensor, false);
> -
> +	err = st_lsm6dsx_shub_set_enable(sensor, false);
>  	if (err < 0)
>  		return err;
>  


  reply	other threads:[~2020-02-14 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 12:37 [PATCH] iio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable Lorenzo Bianconi
2020-02-14 14:17 ` Jonathan Cameron [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-01-02  8:36 Lorenzo Bianconi
2020-01-13 21:43 ` Jonathan Cameron

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=20200214141715.73ec5f52@archlinux \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=lorenzo@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;
as well as URLs for NNTP newsgroup(s).