mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: viperboard: Fix error handling in vprbrd_iio_read_raw
@ 2026-05-05 21:17 Salah Triki
  2026-05-05 22:05 ` Joshua Crofts
  2026-05-06  8:35 ` Andy Shevchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Salah Triki @ 2026-05-05 21:17 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
  Cc: linux-iio, linux-kernel, Salah Triki

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.

Fixes: ffd8a6e7a778 ("iio: adc: Add viperboard adc driver")
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/iio/adc/viperboard_adc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/adc/viperboard_adc.c b/drivers/iio/adc/viperboard_adc.c
index 9bb0b83c8f67..14d018b5aa33 100644
--- a/drivers/iio/adc/viperboard_adc.c
+++ b/drivers/iio/adc/viperboard_adc.c
@@ -72,6 +72,8 @@ static int vprbrd_iio_read_raw(struct iio_dev *iio_dev,
 		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;
 		}
 
 		ret = usb_control_msg(vb->usb_dev,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-06  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-05 21:17 [PATCH] iio: viperboard: Fix error handling in vprbrd_iio_read_raw Salah Triki
2026-05-05 22:05 ` Joshua Crofts
2026-05-05 22:19   ` Maxwell Doose
2026-05-06  8:35 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®