Re: [PATCH RFC] iio: inkern: add out of range error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux