Skip to content

Commit

Permalink
iio: core: Return error for failed read_reg
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matt Fornero authored and jic23 committed Sep 24, 2017
1 parent 7ee3b7e commit 3d62c78
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,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);

Expand Down

0 comments on commit 3d62c78

Please sign in to comment.