Commit bc3a84ac authored by Matt Fornero's avatar Matt Fornero Committed by Thadeu Lima de Souza Cascardo

iio: core: Return error for failed read_reg

BugLink: http://bugs.launchpad.net/bugs/1724783

commit 3d62c78a 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: default avatarMatt Fornero <matt.fornero@mathworks.com>
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
parent 9f8bad6b
...@@ -221,8 +221,10 @@ static ssize_t iio_debugfs_read_reg(struct file *file, char __user *userbuf, ...@@ -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, ret = indio_dev->info->debugfs_reg_access(indio_dev,
indio_dev->cached_reg_addr, indio_dev->cached_reg_addr,
0, &val); 0, &val);
if (ret) if (ret) {
dev_err(indio_dev->dev.parent, "%s: read failed\n", __func__); dev_err(indio_dev->dev.parent, "%s: read failed\n", __func__);
return ret;
}
len = snprintf(buf, sizeof(buf), "0x%X\n", val); len = snprintf(buf, sizeof(buf), "0x%X\n", val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment