summaryrefslogtreecommitdiff
path: root/drivers/iio/frequency
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2018-12-20 10:21:22 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-01-05 19:10:50 +0300
commitae0b3773721f08526c850e2d8dec85bdb870cd12 (patch)
tree1b0925b73f1cf2582567206bd5d648a4ab0f205f /drivers/iio/frequency
parentc546d49656143855093c7b7fde60866e6e23a69d (diff)
downloadlinux-ae0b3773721f08526c850e2d8dec85bdb870cd12.tar.xz
iio: ad9523: fix a missing check of return value
If ad9523_write() fails, indio_dev may get incorrect data. The fix inserts a check for the return value of ad9523_write(), and it fails, returns an error. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/frequency')
-rw-r--r--drivers/iio/frequency/ad9523.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index f3f94fbdd20a..3f9be69499ec 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -943,11 +943,14 @@ static int ad9523_setup(struct iio_dev *indio_dev)
}
}
- for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN)
- ad9523_write(indio_dev,
+ for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN) {
+ ret = ad9523_write(indio_dev,
AD9523_CHANNEL_CLOCK_DIST(i),
AD9523_CLK_DIST_DRIVER_MODE(TRISTATE) |
AD9523_CLK_DIST_PWR_DOWN_EN);
+ if (ret < 0)
+ return ret;
+ }
ret = ad9523_write(indio_dev, AD9523_POWER_DOWN_CTRL, 0);
if (ret < 0)