Commit 06423404 authored by Nuno Sá's avatar Nuno Sá Committed by Jonathan Cameron
Browse files

iio: buffer: Fix wait_queue not being removed



In the edge case where the IIO device is unregistered while we're
buffering, we were directly returning an error without removing the wait
queue. Instead, set 'ret' and break out of the loop.

Fixes: 9eeee3b0 ("iio: Add output buffer support")
Signed-off-by: default avatarNuno Sá <nuno.sa@analog.com>
Reviewed-by: default avatarDavid Lechner <dlechner@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent acc3949a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -228,8 +228,10 @@ static ssize_t iio_buffer_write(struct file *filp, const char __user *buf,
	written = 0;
	add_wait_queue(&rb->pollq, &wait);
	do {
		if (!indio_dev->info)
			return -ENODEV;
		if (!indio_dev->info) {
			ret = -ENODEV;
			break;
		}

		if (!iio_buffer_space_available(rb)) {
			if (signal_pending(current)) {