Skip to contentSkip to conversation

iio: addac: ad74413r: simplify timeout return

PATCH Applied Antoniu Miclaus 3 participants 3 messages Feb 23

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

PATCH v2 1/1 iio: addac: ad74413r: simplify timeout return

Return -ETIMEDOUT directly instead of assigning it to an intermediate variable first.

---
Changes in v2:
- Use wait_for_completion_timeout() directly in if condition instead of assigning to ret first.

 drivers/iio/addac/ad74413r.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/iio/addac/ad74413r.c +3 -6
index a20b4d48c5f7..fe930ce5ee30 100644
@@ -839,12 +839,9 @@ static int _ad74413r_get_single_adc_result(struct ad74413r_state *st,
 	if (ret)
 		return ret;
 
-	ret = wait_for_completion_timeout(&st->adc_data_completion,
-					  msecs_to_jiffies(1000));
-	if (!ret) {
-		ret = -ETIMEDOUT;
-		return ret;
-	}
+	if (!wait_for_completion_timeout(&st->adc_data_completion,
+					 msecs_to_jiffies(1000)))
+		return -ETIMEDOUT;
 
 	ret = regmap_read(st->regmap, AD74413R_REG_ADC_RESULT_X(channel),
 			  &uval);
Signature · 1 line
2.43.0