Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] iio: adc: at91_adc: change at91_ts_sample to return void
@ 2026-02-02 11:57 Antoniu Miclaus
  2026-02-02 15:11 ` David Lechner
  0 siblings, 1 reply; 3+ messages in thread
From: Antoniu Miclaus @ 2026-02-02 11:57 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

The return value of at91_ts_sample() is never checked by its caller.
Change the return type to void to make this explicit. The error
conditions are already logged via dev_err() which provides sufficient
visibility into hardware issues.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
Changes in v2:
 - Changed return type to void instead of replacing -1 with -EIO,
   since the return value is never checked by the caller.

 drivers/iio/adc/at91_adc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 920dd9ffd27a..8942d15b3978 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -304,7 +304,7 @@ static void handle_adc_eoc_trigger(int irq, struct iio_dev *idev)
 	}
 }
 
-static int at91_ts_sample(struct iio_dev *idev)
+static void at91_ts_sample(struct iio_dev *idev)
 {
 	struct at91_adc_state *st = iio_priv(idev);
 	unsigned int xscale, yscale, reg, z1, z2;
@@ -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;
 	}
 	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;
 	}
 	y /= yscale;
 
@@ -363,8 +363,6 @@ static int at91_ts_sample(struct iio_dev *idev)
 	} else {
 		dev_dbg(&idev->dev, "pressure too low: not reporting\n");
 	}
-
-	return 0;
 }
 
 static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
-- 
2.43.0



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

* Re: [PATCH v2] iio: adc: at91_adc: change at91_ts_sample to return void
  2026-02-02 11:57 [PATCH v2] iio: adc: at91_adc: change at91_ts_sample to return void Antoniu Miclaus
@ 2026-02-02 15:11 ` David Lechner
  2026-02-22 18:59   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2026-02-02 15:11 UTC (permalink / raw)
  To: Antoniu Miclaus, Jonathan Cameron, Nuno Sá, Andy Shevchenko,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, linux-iio,
	linux-arm-kernel, linux-kernel

On 2/2/26 5:57 AM, Antoniu Miclaus wrote:
> The return value of at91_ts_sample() is never checked by its caller.
> Change the return type to void to make this explicit. The error
> conditions are already logged via dev_err() which provides sufficient
> visibility into hardware issues.
> 
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
Reviewed-by: David Lechner <dlechner@baylibre.com>



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

* Re: [PATCH v2] iio: adc: at91_adc: change at91_ts_sample to return void
  2026-02-02 15:11 ` David Lechner
@ 2026-02-22 18:59   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-02-22 18:59 UTC (permalink / raw)
  To: David Lechner
  Cc: Antoniu Miclaus, Nuno Sá, Andy Shevchenko, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, linux-iio, linux-arm-kernel,
	linux-kernel

On Mon, 2 Feb 2026 09:11:58 -0600
David Lechner <dlechner@baylibre.com> wrote:

> On 2/2/26 5:57 AM, Antoniu Miclaus wrote:
> > The return value of at91_ts_sample() is never checked by its caller.
> > Change the return type to void to make this explicit. The error
> > conditions are already logged via dev_err() which provides sufficient
> > visibility into hardware issues.
> > 
> > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> > ---  
> Reviewed-by: David Lechner <dlechner@baylibre.com>
> 

Applied. Thanks,


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

end of thread, other threads:[~2026-02-22 18:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02 11:57 [PATCH v2] iio: adc: at91_adc: change at91_ts_sample to return void Antoniu Miclaus
2026-02-02 15:11 ` David Lechner
2026-02-22 18:59   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox