Skip to contentSkip to conversation

iio: admv1013: replace redundant ternary operator with just len

PATCH Applied Colin Ian King 3 participants 3 messages May 7, 2025 – May 8, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: admv1013: replace redundant ternary operator with just len

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.

---
 drivers/iio/frequency/admv1013.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/admv1013.c +1 -1
index 6f50884d7130..d8e8d541990f 100644
@@ -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)
Signature · 1 line
2.49.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Colin Ian King

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.

---

maintainer Applied
#2 lore raw
Quoted 11 lines · On Wed, 7 May 2025 08:49:46 -0500 David Lechner <[email protected]> wrote:
Quoted 7 lines · Colin Ian King

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.

---

Applied.