Re: [PATCH v2] iio: adc: viperboard: Fix error handling in vprbrd_iio_read_raw

From: Jonathan Cameron

Date: Mon May 11 2026 - 13:26:32 EST


On Sat, 9 May 2026 10:56:26 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:

> On Thu, May 07, 2026 at 08:07:51PM +0100, Salah Triki wrote:
> > The driver proceeds to the reception phase even if the preceding
> > transmission fails.
> >
> > This uses a goto error label for an early bail out and ensures the mutex is
> > properly unlocked in case of failure.
>
> ...
>
> > if (ret != sizeof(struct vprbrd_adc_msg)) {
> > - dev_err(&iio_dev->dev, "usb send error on adc read\n");
> > error = -EREMOTEIO;
>
> This also a local variable that doesn't need to be in the critical section,
> right?
Tweaked and applied to the fixes-togreg branch of iio.git + marked for stable.

>
> > + mutex_unlock(&vb->lock);
> > + dev_err(&iio_dev->dev, "usb send error on adc read\n");
> > + goto error;
> > }
>