Devicetree
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Angelo Dureghello <adureghello@baylibre.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v6 5/6] iio: adc: ad7606: exit for invalid fdt dt_schema properties
Date: Sun, 25 May 2025 15:01:26 +0100	[thread overview]
Message-ID: <20250525150126.0f38696f@jic23-huawei> (raw)
In-Reply-To: <20250522-wip-bl-ad7606-calibration-v6-5-487b90433da0@baylibre.com>

On Thu, 22 May 2025 15:27:06 +0200
Angelo Dureghello <adureghello@baylibre.com> wrote:

> From: Angelo Dureghello <adureghello@baylibre.com>
> 
> Fix ad7606_get_chan_config() fdt parsing function to exit for error in
> case of invalid dt_schema values.
> 
> Idea is to not allowing to proceed over when there are values that are
> not allowed from the dt_schema.

"Idea is to not proceed when there are values that are not allowed
under the dt_shema."

> 
> Fixes: f3838e934dff ("iio: adc: ad7606: add support for AD7606C-{16,18} parts")

I'm in favour of consistency but it's only a 'fix' in the sense of blocking
bad DT cleanly.  So I don't think the Fixes tag is appropriate here.

> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>

> ---
>  drivers/iio/adc/ad7606.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index bb0c89fc618874f4a5948d8e537716f87127bc92..f832fd0daf50a69a892636018bda2e43f73d1570 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -319,15 +319,13 @@ static int ad7606_get_chan_config(struct iio_dev *indio_dev, int ch,
>  
>  		ret = fwnode_property_read_u32(child, "reg", &reg);
>  		if (ret)
> -			continue;
> +			return ret;
>  
>  		/* channel number (here) is from 1 to num_channels */
> -		if (reg < 1 || reg > num_channels) {
> -			dev_warn(dev,
> -				 "Invalid channel number (ignoring): %d\n", reg);
> -			continue;
> -		}
> +		if (reg < 1 || reg > num_channels)
> +			return -EINVAL;
>  
> +		/* Loop until we are in the right channel. */
>  		if (reg != (ch + 1))
>  			continue;
>  
> 


  reply	other threads:[~2025-05-25 14:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 13:27 [PATCH v6 0/6] iio: adc: add ad7606 calibration support Angelo Dureghello
2025-05-22 13:27 ` [PATCH v6 1/6] Documentation: ABI: IIO: add calibconv_delay documentation Angelo Dureghello
2025-05-25 13:56   ` Jonathan Cameron
2025-05-22 13:27 ` [PATCH v6 2/6] iio: core: add ADC delay calibration definition Angelo Dureghello
2025-05-22 13:27 ` [PATCH v6 3/6] iio: adc: ad7606: add offset and phase calibration support Angelo Dureghello
2025-05-22 13:27 ` [PATCH v6 4/6] dt-bindings: iio: adc: adi,ad7606: add gain " Angelo Dureghello
2025-05-22 13:27 ` [PATCH v6 5/6] iio: adc: ad7606: exit for invalid fdt dt_schema properties Angelo Dureghello
2025-05-25 14:01   ` Jonathan Cameron [this message]
2025-05-22 13:27 ` [PATCH v6 6/6] iio: adc: ad7606: add gain calibration support Angelo Dureghello
2025-05-25 14:04   ` Jonathan Cameron

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=20250525150126.0f38696f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=adureghello@baylibre.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox