summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMircea Caprioru <mircea.caprioru@analog.com>2020-04-01 14:22:30 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-04-19 19:50:01 +0300
commit5403f2807623b2e470c889f8d937e2f1a859251e (patch)
treedb18c548eb34a9d9ddb586c9a48c269efe08304e
parent6f63c90aa3e8ca14b4024cee5d97795a408e8949 (diff)
downloadlinux-5403f2807623b2e470c889f8d937e2f1a859251e.tar.xz
iio: core: Fix handling of 'dB'
This patch fixes the call to iio_str_to_fixpoint when using 'dB' sufix. Before this the scale_db was not used when parsing the string written to the attribute and it failed with invalid value. Fixes: b8528224741b ("iio: core: Handle 'dB' suffix in core") Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/industrialio-core.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index eac63c1bb8da..38adb603037f 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -909,14 +909,11 @@ static ssize_t iio_write_channel_info(struct device *dev,
return -EINVAL;
integer = ch;
} else {
- ret = iio_str_to_fixpoint(buf, fract_mult, &integer, &fract);
+ ret = __iio_str_to_fixpoint(buf, fract_mult, &integer, &fract,
+ scale_db);
if (ret)
return ret;
}
- ret = __iio_str_to_fixpoint(buf, fract_mult, &integer, &fract,
- scale_db);
- if (ret)
- return ret;
ret = indio_dev->info->write_raw(indio_dev, this_attr->c,
integer, fract, this_attr->address);