Skip to content

Commit 5dba4b1

Browse files
Colin Ian Kingjic23
authored andcommitted
iio: ensure ret is initialized to zero before entering do loop
A recent fix to iio_buffer_read_first_n_outer removed ret from being set by a return from wait_event_interruptible and also added a continue in a loop which causes the variable ret to not be set when it reaches the end of the loop. Fix this by initializing ret to zero. Also remove extraneous white space at the end of the loop. Fixes: fcf68f3 ("fix sched WARNING "do not call blocking ops when !TASK_RUNNING") Signed-off-by: Colin Ian King <colin.king@canonical.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 307fe9d commit 5dba4b1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/iio/industrialio-buffer.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
110110
DEFINE_WAIT_FUNC(wait, woken_wake_function);
111111
size_t datum_size;
112112
size_t to_wait;
113-
int ret;
113+
int ret = 0;
114114

115115
if (!indio_dev->info)
116116
return -ENODEV;
@@ -153,7 +153,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
153153
ret = rb->access->read_first_n(rb, n, buf);
154154
if (ret == 0 && (filp->f_flags & O_NONBLOCK))
155155
ret = -EAGAIN;
156-
} while (ret == 0);
156+
} while (ret == 0);
157157
remove_wait_queue(&rb->pollq, &wait);
158158

159159
return ret;

0 commit comments

Comments
 (0)