* [PATCH RFC] iio: inkern: add out of range error message
@ 2015-01-01 18:13 Stefan Wahren
2015-01-04 10:36 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Wahren @ 2015-01-01 18:13 UTC (permalink / raw)
To: jic23; +Cc: knaack.h, lars, pmeerw, linux-iio, Stefan Wahren
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>
---
drivers/iio/inkern.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 866fe90..30a8d9c 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];
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RFC] iio: inkern: add out of range error message
2015-01-01 18:13 [PATCH RFC] iio: inkern: add out of range error message Stefan Wahren
@ 2015-01-04 10:36 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2015-01-04 10:36 UTC (permalink / raw)
To: Stefan Wahren; +Cc: knaack.h, lars, pmeerw, linux-iio
On 01/01/15 18:13, Stefan Wahren wrote:
> 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>
Seems sensible. Applied to the togreg branch of iio.git.
> ---
> drivers/iio/inkern.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index 866fe90..30a8d9c 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];
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-04 10:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-01 18:13 [PATCH RFC] iio: inkern: add out of range error message Stefan Wahren
2015-01-04 10:36 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.