Re: [PATCH v2] iio: adc: viperboard: Fix error handling in vprbrd_iio_read_raw
From: Andy Shevchenko
Date: Sat May 09 2026 - 03:56:54 EST
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?
> + mutex_unlock(&vb->lock);
> + dev_err(&iio_dev->dev, "usb send error on adc read\n");
> + goto error;
> }
--
With Best Regards,
Andy Shevchenko