Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: at91_adc: return proper error code from at91_ts_sample()
@ 2026-01-30 13:51 Antoniu Miclaus
  2026-01-31 17:10 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Antoniu Miclaus @ 2026-01-30 13:51 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Antoniu Miclaus,
	linux-iio, linux-arm-kernel, linux-kernel

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>
---
 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;
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-31 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox