summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorMatt Fornero <matt.fornero@mathworks.com>2017-09-05 16:34:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-12 11:27:34 +0200
commit2c29a386809087a98e97c9775f1febdc9de6ab02 (patch)
tree2aa6c2a0294dcf572f3dd337a17ae40a1ed40e37 /drivers/iio
parentb86df98578ab321655a74e00f755e3636dcf5747 (diff)
iio: core: Return error for failed read_reg
commit 3d62c78a6eb9a7d67bace9622b66ad51e81c5f9b upstream. If an IIO device returns an error code for a read access via debugfs, it is currently ignored by the IIO core (other than emitting an error message). Instead, return this error code to user space, so upper layers can detect it correctly. Signed-off-by: Matt Fornero <matt.fornero@mathworks.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/industrialio-core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 131b434af994..e08a3c794120 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -221,8 +221,10 @@ static ssize_t iio_debugfs_read_reg(struct file *file, char __user *userbuf,
ret = indio_dev->info->debugfs_reg_access(indio_dev,
indio_dev->cached_reg_addr,
0, &val);
- if (ret)
+ if (ret) {
dev_err(indio_dev->dev.parent, "%s: read failed\n", __func__);
+ return ret;
+ }
len = snprintf(buf, sizeof(buf), "0x%X\n", val);