lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260131171054.2b34e357@jic23-huawei>
Date: Sat, 31 Jan 2026 17:10:54 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>
Cc: David Lechner <dlechner@...libre.com>, Nuno Sá
 <nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>, Nicolas Ferre
 <nicolas.ferre@...rochip.com>, Alexandre Belloni
 <alexandre.belloni@...tlin.com>, Claudiu Beznea <claudiu.beznea@...on.dev>,
 <linux-iio@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: adc: at91_adc: return proper error code from
 at91_ts_sample()

On Fri, 30 Jan 2026 15:51:22 +0200
Antoniu Miclaus <antoniu.miclaus@...log.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@...log.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;
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ