diff options
author | Daniel Baluta <daniel.baluta@intel.com> | 2014-12-23 15:22:25 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-01-05 18:59:51 +0000 |
commit | a3da4fa301ae60aac688ca320fb8b46a053d6d25 (patch) | |
tree | 6aef1583fdcebdb998fd732fe63a4fb53e470bd9 /drivers/iio/imu/kmx61.c | |
parent | 4e8439779ef613135049cea77f50cf58ccc44255 (diff) |
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: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu/kmx61.c')
-rw-r--r-- | drivers/iio/imu/kmx61.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c index 52c943d50bef..6eaecb95c2d0 100644 --- a/drivers/iio/imu/kmx61.c +++ b/drivers/iio/imu/kmx61.c @@ -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) { |