Commit ae0b3773 authored by Kangjie Lu's avatar Kangjie Lu Committed by Jonathan Cameron

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: default avatarKangjie Lu <kjlu@umn.edu>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent c546d496
...@@ -943,11 +943,14 @@ static int ad9523_setup(struct iio_dev *indio_dev) ...@@ -943,11 +943,14 @@ static int ad9523_setup(struct iio_dev *indio_dev)
} }
} }
for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN) for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN) {
ad9523_write(indio_dev, ret = ad9523_write(indio_dev,
AD9523_CHANNEL_CLOCK_DIST(i), AD9523_CHANNEL_CLOCK_DIST(i),
AD9523_CLK_DIST_DRIVER_MODE(TRISTATE) | AD9523_CLK_DIST_DRIVER_MODE(TRISTATE) |
AD9523_CLK_DIST_PWR_DOWN_EN); AD9523_CLK_DIST_PWR_DOWN_EN);
if (ret < 0)
return ret;
}
ret = ad9523_write(indio_dev, AD9523_POWER_DOWN_CTRL, 0); ret = ad9523_write(indio_dev, AD9523_POWER_DOWN_CTRL, 0);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment