Skip to content

Commit ae0b377

Browse files
kengiterJonathan Cameron
authored andcommitted
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>
1 parent c546d49 commit ae0b377

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎drivers/iio/frequency/ad9523.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,11 +943,14 @@ static int ad9523_setup(struct iio_dev *indio_dev)
943943
}
944944
}
945945

946-
for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN)
947-
ad9523_write(indio_dev,
946+
for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN) {
947+
ret = ad9523_write(indio_dev,
948948
AD9523_CHANNEL_CLOCK_DIST(i),
949949
AD9523_CLK_DIST_DRIVER_MODE(TRISTATE) |
950950
AD9523_CLK_DIST_PWR_DOWN_EN);
951+
if (ret < 0)
952+
return ret;
953+
}
951954

952955
ret = ad9523_write(indio_dev, AD9523_POWER_DOWN_CTRL, 0);
953956
if (ret < 0)

0 commit comments

Comments
 (0)