Skip to content

Commit 2c29a38

Browse files
Matt Fornerogregkh
authored andcommitted
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>
1 parent b86df98 commit 2c29a38

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/iio/industrialio-core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,10 @@ static ssize_t iio_debugfs_read_reg(struct file *file, char __user *userbuf,
221221
ret = indio_dev->info->debugfs_reg_access(indio_dev,
222222
indio_dev->cached_reg_addr,
223223
0, &val);
224-
if (ret)
224+
if (ret) {
225225
dev_err(indio_dev->dev.parent, "%s: read failed\n", __func__);
226+
return ret;
227+
}
226228

227229
len = snprintf(buf, sizeof(buf), "0x%X\n", val);
228230

0 commit comments

Comments
 (0)