Re: [PATCH v4 2/2] iio: adc: palmas_gpadc: Use guard(mutex) to manage locks
From: Jonathan Cameron
Date: Fri Nov 27 2026 - 23:02:53 EST
On Thu, 26 Nov 2026 14:26:21 +0100
> > static int palmas_gpadc_write_event_value(struct iio_dev *indio_dev,
> > @@ -739,19 +725,18 @@ static int palmas_gpadc_write_event_value(struct iio_dev *indio_dev,
> > {
> > struct palmas_gpadc *adc = iio_priv(indio_dev);
> > int adc_chan = chan->channel;
> > - int old;
> > - int ret;
> >
> > if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
> > return -EINVAL;
> >
> > - mutex_lock(&adc->lock);
> > + guard(mutex)(&adc->lock);
> > +
> > switch (info) {
> > - case IIO_EV_INFO_VALUE:
> > - if (val < 0 || val > 0xFFF) {
> > - ret = -EINVAL;
> > - goto out_unlock;
> > - }
> > + case IIO_EV_INFO_VALUE: {
> > + int old;
> > +
> > + if (val < 0 || val > 0xFFF)
> > + return -EINVAL;
>
> Not introduced by this patch (I sound like Sashiko :) ), but -ERANGE is preferred.
>
> This could be tweaked whilst applying though.
Backlog too large for this sort of thing today.
So will leave it for now.
Series applied to the testing branch of iio.git.
Thanks,
Jonathan
>