diff options
author | Alexandru Ardelean <alexandru.ardelean@analog.com> | 2019-11-01 10:35:04 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-11-03 11:44:29 +0100 |
commit | 38262c01ead40f2b061e8b7e6abe254b538d856c (patch) | |
tree | e661849606780ab4050e934b0c5f0cbcc712865d /drivers/iio/imu | |
parent | iio: imu: adis16480: assign bias value only if operation succeeded (diff) | |
download | linux-38262c01ead40f2b061e8b7e6abe254b538d856c.tar.xz linux-38262c01ead40f2b061e8b7e6abe254b538d856c.zip |
iio: imu: adis: assign read val in debugfs hook only if op successful
This was also caught by the `-Wmaybe-uninitialized` warning, which
(ironically as-is) it makes quite a lot of sense to do for this.
The code that actually calls this function will fail to copy on
the uninitialized value. Hence, patch does not need to go into stable.
Fixes: 78026a6fde8f7 ("iio:imu:adis: Add debugfs register access support")
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/imu')
-rw-r--r-- | drivers/iio/imu/adis.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c index dc2f9e061d98..85de565a4e80 100644 --- a/drivers/iio/imu/adis.c +++ b/drivers/iio/imu/adis.c @@ -229,7 +229,8 @@ int adis_debugfs_reg_access(struct iio_dev *indio_dev, int ret; ret = adis_read_reg_16(adis, reg, &val16); - *readval = val16; + if (ret == 0) + *readval = val16; return ret; } else { |