Re: [PATCH] iio: viperboard: Fix error handling in vprbrd_iio_read_raw
From: Andy Shevchenko
Date: Wed May 06 2026 - 04:35:54 EST
On Tue, May 05, 2026 at 10:17:50PM +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;
> + mutex_unlock(&vb->lock);
> + goto error;
Printing message can be out from critical section (yeah, the guard()() or
whatever change may do it differently, but it's unrelated to this patch).
> }
--
With Best Regards,
Andy Shevchenko