Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
	linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: at91_adc: return proper error code from at91_ts_sample()
Date: Sat, 31 Jan 2026 17:10:54 +0000	[thread overview]
Message-ID: <20260131171054.2b34e357@jic23-huawei> (raw)
In-Reply-To: <20260130135126.136861-1-antoniu.miclaus@analog.com>

On Fri, 30 Jan 2026 15:51:22 +0200
Antoniu Miclaus <antoniu.miclaus@analog.com> wrote:

> Return -EIO instead of -1 when xscale or yscale read from hardware
> registers is zero. Using -EIO since this indicates unexpected data
> from the hardware rather than an invalid argument.
> 
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
This is a little pointless as nothing actually reads the return value.
It might be better to either make that clear by changing the return type
or figure out if it actually is useful for the caller to know this failed.

On it's own this patch gets us very little even though it looks very
sensible in isolation!

Thanks,

Jonathan

> ---
>  drivers/iio/adc/at91_adc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 920dd9ffd27a..5e8719d5ac01 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -323,7 +323,7 @@ static int at91_ts_sample(struct iio_dev *idev)
>  	xscale = (reg >> 16) & xyz_mask;
>  	if (xscale == 0) {
>  		dev_err(&idev->dev, "Error: xscale == 0!\n");
> -		return -1;
> +		return -EIO;
>  	}
>  	x /= xscale;
>  
> @@ -334,7 +334,7 @@ static int at91_ts_sample(struct iio_dev *idev)
>  	yscale = (reg >> 16) & xyz_mask;
>  	if (yscale == 0) {
>  		dev_err(&idev->dev, "Error: yscale == 0!\n");
> -		return -1;
> +		return -EIO;
>  	}
>  	y /= yscale;
>  



      reply	other threads:[~2026-01-31 17:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30 13:51 [PATCH] iio: adc: at91_adc: return proper error code from at91_ts_sample() Antoniu Miclaus
2026-01-31 17:10 ` 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=20260131171054.2b34e357@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=dlechner@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=nuno.sa@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox