Re: [PATCH 2/2] iio: addac: ad74413r: simplify timeout return

From: Andy Shevchenko

Date: Fri Feb 20 2026 - 09:08:54 EST


On Fri, Feb 20, 2026 at 03:18:47PM +0200, Antoniu Miclaus wrote:
> Return -ETIMEDOUT directly instead of assigning it to an intermediate
> variable first.

...

> ret = wait_for_completion_timeout(&st->adc_data_completion,
> msecs_to_jiffies(1000));
> - if (!ret) {
> - ret = -ETIMEDOUT;
> - return ret;
> - }
> + if (!ret)
> + return -ETIMEDOUT;

I would prefer to have just

if (!wait_for_completion_timeout(&st->adc_data_completion,
msecs_to_jiffies(1000)))
return -ETIMEDOUT;

Using ret in a different semantics might lead to subtle issues in case some
code sneaks in and out of a sudden will recognize positive value as something
else.

--
With Best Regards,
Andy Shevchenko