aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fornero <matt.fornero@mathworks.com>2017-09-05 10:34:10 -0400
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-09-24 11:58:32 -0400
commit3d62c78a6eb9a7d67bace9622b66ad51e81c5f9b (patch)
tree42f31a81b456cc4ef4958e3f108c3e9407c0e06e
parent7ee3b7ebcb74714df6d94c8f500f307e1ee5dda5 (diff)
iio: core: Return error for failed read_reg
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> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-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 17ec4cee51dc..a47428b4d31b 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -310,8 +310,10 @@ static ssize_t iio_debugfs_read_reg(struct file *file, char __user *userbuf,
310 ret = indio_dev->info->debugfs_reg_access(indio_dev, 310 ret = indio_dev->info->debugfs_reg_access(indio_dev,
311 indio_dev->cached_reg_addr, 311 indio_dev->cached_reg_addr,
312 0, &val); 312 0, &val);
313 if (ret) 313 if (ret) {
314 dev_err(indio_dev->dev.parent, "%s: read failed\n", __func__); 314 dev_err(indio_dev->dev.parent, "%s: read failed\n", __func__);
315 return ret;
316 }
315 317
316 len = snprintf(buf, sizeof(buf), "0x%X\n", val); 318 len = snprintf(buf, sizeof(buf), "0x%X\n", val);
317 319