Re: [PATCH] iio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri,  7 Feb 2020 13:37:54 +0100
Lorenzo Bianconi <lorenzo@xxxxxxxxxx> 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@xxxxxxxxxx>
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;
>  




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux