All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Stefan Wahren <stefan.wahren@i2se.com>
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH RFC] iio: inkern: add out of range error message
Date: Sun, 04 Jan 2015 10:36:11 +0000	[thread overview]
Message-ID: <54A9179B.1000505@kernel.org> (raw)
In-Reply-To: <1420136004-2058-1-git-send-email-stefan.wahren@i2se.com>

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];
>  }
> 


      reply	other threads:[~2015-01-04 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54A9179B.1000505@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.