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>
This commit is contained in:
parent
4193c0f1d8
commit
1f202725b7
|
@ -116,8 +116,11 @@ static int __of_iio_simple_xlate(struct iio_dev *indio_dev,
|
||||||
if (!iiospec->args_count)
|
if (!iiospec->args_count)
|
||||||
return 0;
|
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 -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
return iiospec->args[0];
|
return iiospec->args[0];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue