[PATCH 0/5] iio: remove redundant else after return

Antoniu Miclaus posted 5 patches 1 month, 1 week ago
drivers/iio/adc/ad7298.c       | 4 ++--
drivers/iio/adc/ad7606.c       | 4 ++--
drivers/iio/dac/ad5592r-base.c | 4 ++--
drivers/iio/dac/ad5758.c       | 6 +++---
drivers/iio/filter/admv8818.c  | 4 ++--
5 files changed, 11 insertions(+), 11 deletions(-)
[PATCH 0/5] iio: remove redundant else after return
Posted by Antoniu Miclaus 1 month, 1 week ago
Remove redundant else branches after return statements across several
IIO drivers (ad7298, ad7606, ad5592r, ad5758, admv8818) to simplify
control flow.

Antoniu Miclaus (5):
  iio: adc: ad7298: remove redundant else after return
  iio: adc: ad7606: remove redundant else after return
  iio: dac: ad5592r-base: remove redundant else after return
  iio: dac: ad5758: remove redundant else after return
  iio: filter: admv8818: remove redundant else after return

 drivers/iio/adc/ad7298.c       | 4 ++--
 drivers/iio/adc/ad7606.c       | 4 ++--
 drivers/iio/dac/ad5592r-base.c | 4 ++--
 drivers/iio/dac/ad5758.c       | 6 +++---
 drivers/iio/filter/admv8818.c  | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.43.0
Re: [PATCH 0/5] iio: remove redundant else after return
Posted by Andy Shevchenko 1 month, 1 week ago
On Fri, Feb 20, 2026 at 03:33:29PM +0200, Antoniu Miclaus wrote:
> Remove redundant else branches after return statements across several
> IIO drivers (ad7298, ad7606, ad5592r, ad5758, admv8818) to simplify
> control flow.

While technically you are correct, the only patch 5 makes sense to me.
The rest might be better with 'else' be present. It depends on the logic
between the lines, if they are of the same semantics and it's not about
returning error code vs. 0 (success), it may be better to read them
if they are started on the same column.

TL;DR: I am not going to NAK, but patches 1-4 is an unneeded churn to me.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 0/5] iio: remove redundant else after return
Posted by Jonathan Cameron 1 month, 1 week ago
On Fri, 20 Feb 2026 16:13:30 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Fri, Feb 20, 2026 at 03:33:29PM +0200, Antoniu Miclaus wrote:
> > Remove redundant else branches after return statements across several
> > IIO drivers (ad7298, ad7606, ad5592r, ad5758, admv8818) to simplify
> > control flow.  
> 
> While technically you are correct, the only patch 5 makes sense to me.
> The rest might be better with 'else' be present. It depends on the logic
> between the lines, if they are of the same semantics and it's not about
> returning error code vs. 0 (success), it may be better to read them
> if they are started on the same column.

I agree.  When it's a choice between two 'good' paths and the author
felt if / else made that choice aspect clear than I've always taken the
view that that is reasonable.

So I've picked up patch 5 but not the others.  5 was a little stronger as
it's if (A) do something else do nothing.

> 
> TL;DR: I am not going to NAK, but patches 1-4 is an unneeded churn to me.
>
Re: [PATCH 0/5] iio: remove redundant else after return
Posted by Andy Shevchenko 1 month, 1 week ago
On Fri, Feb 20, 2026 at 04:13:35PM +0200, Andy Shevchenko wrote:
> On Fri, Feb 20, 2026 at 03:33:29PM +0200, Antoniu Miclaus wrote:
> > Remove redundant else branches after return statements across several
> > IIO drivers (ad7298, ad7606, ad5592r, ad5758, admv8818) to simplify
> > control flow.
> 
> While technically you are correct, the only patch 5 makes sense to me.
> The rest might be better with 'else' be present. It depends on the logic
> between the lines, if they are of the same semantics and it's not about
> returning error code vs. 0 (success), it may be better to read them
> if they are started on the same column.
> 
> TL;DR: I am not going to NAK, but patches 1-4 is an unneeded churn to me.

For the record you may look at my patches in the Git history on the same
matter, they do not kill all 'else':s in such cases.

git log --no-merges -p --author="Andy Shevchenko" --grep "redundant 'else'"

-- 
With Best Regards,
Andy Shevchenko