Commit a3da4fa3 authored by Daniel Baluta's avatar Daniel Baluta Committed by Jonathan Cameron

iio: imu: kmx61: Don't ignore kmx61_set_power_state errors

..except while in an error handler, where there is nothing
to be done anyway.
Signed-off-by: default avatarDaniel Baluta <daniel.baluta@intel.com>
Reviewed-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 4e843977
......@@ -830,7 +830,12 @@ static int kmx61_read_raw(struct iio_dev *indio_dev,
}
mutex_lock(&data->lock);
kmx61_set_power_state(data, true, chan->address);
ret = kmx61_set_power_state(data, true, chan->address);
if (ret) {
mutex_unlock(&data->lock);
return ret;
}
ret = kmx61_read_measurement(data, base_reg, chan->scan_index);
if (ret < 0) {
kmx61_set_power_state(data, false, chan->address);
......@@ -839,9 +844,11 @@ static int kmx61_read_raw(struct iio_dev *indio_dev,
}
*val = sign_extend32(ret >> chan->scan_type.shift,
chan->scan_type.realbits - 1);
kmx61_set_power_state(data, false, chan->address);
ret = kmx61_set_power_state(data, false, chan->address);
mutex_unlock(&data->lock);
if (ret)
return ret;
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
......
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