summaryrefslogtreecommitdiffstats
path: root/drivers/iio/inkern.c
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2015-01-01 18:13:24 +0000
committerJonathan Cameron <jic23@kernel.org>2015-01-05 18:59:50 +0000
commit1f202725b70c3d6dc736904a0d1b77a5faed6690 (patch)
tree2ed4ac6cdaa8bdbd34c5f5da25a9021e66a2fbba /drivers/iio/inkern.c
parent4193c0f1d8631d439cea5f78329fe70f3a6e9128 (diff)
downloadop-kernel-dev-1f202725b70c3d6dc736904a0d1b77a5faed6690.zip
op-kernel-dev-1f202725b70c3d6dc736904a0d1b77a5faed6690.tar.gz
iio: inkern: add out of range error message
If the DT contains an invalid channel specifier then the probe of iio_hwmon fails with the following message: iio_hwmon: probe of iio_hwmon failed with error -22 So it's better to print out the relevant channel specifier in error case to locate the problem. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/inkern.c')
-rw-r--r--drivers/iio/inkern.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 21655fd..2800b80 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -116,8 +116,11 @@ static int __of_iio_simple_xlate(struct iio_dev *indio_dev,
if (!iiospec->args_count)
return 0;
- if (iiospec->args[0] >= indio_dev->num_channels)
+ if (iiospec->args[0] >= indio_dev->num_channels) {
+ dev_err(&indio_dev->dev, "invalid channel index %u\n",
+ iiospec->args[0]);
return -EINVAL;
+ }
return iiospec->args[0];
}
OpenPOWER on IntegriCloud