summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/impedance-analyzer/ad5933.c
diff options
context:
space:
mode:
authorPhil Turnbull <phil.turnbull@oracle.com>2016-07-21 15:23:13 (GMT)
committerJonathan Cameron <jic23@kernel.org>2016-08-15 14:39:04 (GMT)
commit776b645315d372e06e46167194605d308aa1a790 (patch)
tree38f2b8164e92aa01a329af412e98176fb08d7804 /drivers/staging/iio/impedance-analyzer/ad5933.c
parentbb9947c3a14e781eb0f137728e7e55ec8d848991 (diff)
downloadlinux-776b645315d372e06e46167194605d308aa1a790.tar.xz
staging: iio: ad5933: Return correct value for AD5933_OUT_RANGE.
The 'break' statement after calling ad5933_cmd only breaks out of the 'for' loop, which then unconditionally sets the return value to -EINVAL. Move the initialisation of 'ret' so we return the correct value. Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio/impedance-analyzer/ad5933.c')
-rw-r--r--drivers/staging/iio/impedance-analyzer/ad5933.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 170ac98..24c348d 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -419,6 +419,7 @@ static ssize_t ad5933_store(struct device *dev,
mutex_lock(&indio_dev->mlock);
switch ((u32)this_attr->address) {
case AD5933_OUT_RANGE:
+ ret = -EINVAL;
for (i = 0; i < 4; i++)
if (val == st->range_avail[i]) {
st->ctrl_hb &= ~AD5933_CTRL_RANGE(0x3);
@@ -426,7 +427,6 @@ static ssize_t ad5933_store(struct device *dev,
ret = ad5933_cmd(st, 0);
break;
}
- ret = -EINVAL;
break;
case AD5933_IN_PGA_GAIN:
if (sysfs_streq(buf, "1")) {