From: Matt Fornero Date: Tue, 5 Sep 2017 14:34:10 +0000 (+0200) Subject: iio: core: Return error for failed read_reg X-Git-Tag: v4.9.55~74 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9af1bd5e705a5a9dbeff42bab077afe3ba881968;p=profile%2Fwearable%2Fplatform%2Fkernel%2Flinux-4.9-exynos9110.git 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 Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index fc340ed..c5bc731 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -306,8 +306,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);