Commit eeb82b54 authored by Colin Ian King's avatar Colin Ian King Committed by Jonathan Cameron

iio: buffer: Fix uninitialized variable ret

When !iio_buffer_space_available(rb) is true and signal_pending(current)
is false the end of the do-while loop is reached and the uninitialized
variable ret is zero checked. Fix this by initializing variable ret to
zero.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 9eeee3b0 ("iio: Add output buffer support")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20211015153254.33783-1-colin.king@canonical.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 0be84447
......@@ -179,7 +179,7 @@ static ssize_t iio_buffer_write(struct file *filp, const char __user *buf,
struct iio_buffer *rb = ib->buffer;
struct iio_dev *indio_dev = ib->indio_dev;
DEFINE_WAIT_FUNC(wait, woken_wake_function);
int ret;
int ret = 0;
size_t written;
if (!indio_dev->info)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment