Re: [PATCH] iio: humidity: ens210: remove compiler warning workaround

From: Andy Shevchenko

Date: Tue Jun 02 2026 - 14:10:21 EST


On Fri, May 22, 2026 at 01:37:17PM +0100, Jonathan Cameron wrote:
> On Fri, 22 May 2026 00:25:08 -0500
> Maxwell Doose <m32285159@xxxxxxxxx> wrote:
> > On Thu, May 21, 2026 at 8:26 PM David Lechner <dlechner@xxxxxxxxxxxx> wrote:

...

> > > - case IIO_CHAN_INFO_RAW:
> > > - scoped_guard(mutex, &data->lock) {
> > > - ret = ens210_get_measurement(
> > > - indio_dev, channel->type == IIO_TEMP, val);
> > > - if (ret)
> > > - return ret;
> > > - return IIO_VAL_INT;
> > > - }

> > > - return -EINVAL; /* compiler warning workaround */

We may just drop this return statement, but in this case some people may be
confused. In addition the patch fixes the indentation of the function
parameters, which is good on itself.

> > > + case IIO_CHAN_INFO_RAW: {
> > > + guard(mutex)(&data->lock);
> > > +
> > > + ret = ens210_get_measurement(indio_dev, channel->type == IIO_TEMP,
> > > + val);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + return IIO_VAL_INT;
> > > + }

> > I'm questioning how that initial commit got merged at all, they
> > could've just used guard()() with {} (the kind of thing to make me
> > want to take a look at this file even further!). Visually looks good
> > to me but will follow-up later with rb if it all checks out.
>
> The guard stuff was fairly new at the time so we were still working out what
> patterns make sense. Took a little while for consensus to emerge!
>
> Anyhow patch is obviously correct and a cleanup so applied to the testing
> branch of iio.git. Happy to add tags etc for next few days
> (or drop it if I'm missing something!)

Taking the above into consideration,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

--
With Best Regards,
Andy Shevchenko