Linux IIO development
 help / color / mirror / Atom feed
* [PATCH][next] iio: admv1013: replace redundant ternary operator with just len
@ 2025-05-07 13:45 Colin Ian King
  2025-05-07 13:49 ` David Lechner
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Ian King @ 2025-05-07 13:45 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	linux-iio
  Cc: kernel-janitors, linux-kernel

The variable ret is being assigned a return value and non-zero error
return paths are taken at all stages. At the end of the function ret
is always zero, so the ternary operator checking for zero ret is
redundant and can be replaced with just len instead.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/iio/frequency/admv1013.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/frequency/admv1013.c b/drivers/iio/frequency/admv1013.c
index 6f50884d7130..d8e8d541990f 100644
--- a/drivers/iio/frequency/admv1013.c
+++ b/drivers/iio/frequency/admv1013.c
@@ -319,7 +319,7 @@ static ssize_t admv1013_write(struct iio_dev *indio_dev,
 		return -EINVAL;
 	}
 
-	return ret ? ret : len;
+	return len;
 }
 
 static int admv1013_update_quad_filters(struct admv1013_state *st)
-- 
2.49.0


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

* Re: [PATCH][next] iio: admv1013: replace redundant ternary operator with just len
  2025-05-07 13:45 [PATCH][next] iio: admv1013: replace redundant ternary operator with just len Colin Ian King
@ 2025-05-07 13:49 ` David Lechner
  2025-05-08 19:13   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2025-05-07 13:49 UTC (permalink / raw)
  To: Colin Ian King, Lars-Peter Clausen, Michael Hennerich,
	Antoniu Miclaus, Jonathan Cameron, Nuno Sá, Andy Shevchenko,
	linux-iio
  Cc: kernel-janitors, linux-kernel

On 5/7/25 8:45 AM, Colin Ian King wrote:
> The variable ret is being assigned a return value and non-zero error
> return paths are taken at all stages. At the end of the function ret
> is always zero, so the ternary operator checking for zero ret is
> redundant and can be replaced with just len instead.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---

Reviewed-by: David Lechner <dlechner@baylibre.com>


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

* Re: [PATCH][next] iio: admv1013: replace redundant ternary operator with just len
  2025-05-07 13:49 ` David Lechner
@ 2025-05-08 19:13   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-05-08 19:13 UTC (permalink / raw)
  To: David Lechner
  Cc: Colin Ian King, Lars-Peter Clausen, Michael Hennerich,
	Antoniu Miclaus, Nuno Sá, Andy Shevchenko, linux-iio,
	kernel-janitors, linux-kernel

On Wed, 7 May 2025 08:49:46 -0500
David Lechner <dlechner@baylibre.com> wrote:

> On 5/7/25 8:45 AM, Colin Ian King wrote:
> > The variable ret is being assigned a return value and non-zero error
> > return paths are taken at all stages. At the end of the function ret
> > is always zero, so the ternary operator checking for zero ret is
> > redundant and can be replaced with just len instead.
> > 
> > Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> > ---  
> 
> Reviewed-by: David Lechner <dlechner@baylibre.com>
> 

Applied.

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

end of thread, other threads:[~2025-05-08 19:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-07 13:45 [PATCH][next] iio: admv1013: replace redundant ternary operator with just len Colin Ian King
2025-05-07 13:49 ` David Lechner
2025-05-08 19:13   ` Jonathan Cameron

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