Skip to content

Commit

Permalink
iio: kfifo: Set update_needed to false only if a buffer was allocated
Browse files Browse the repository at this point in the history
Check whether the allocation of a new kfifo buffer failed or not before
setting the update_needed flag to false. This will make
iio_request_update_kfifo() try to allocate a new buffer the next time a
buffer update is requested.

Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Gabriele Mazzotta authored and Jonathan Cameron committed May 7, 2015
1 parent 0e81bc9 commit e5f1efb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iio/kfifo_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ static int iio_request_update_kfifo(struct iio_buffer *r)
kfifo_free(&buf->kf);
ret = __iio_allocate_kfifo(buf, buf->buffer.bytes_per_datum,
buf->buffer.length);
buf->update_needed = false;
if (ret >= 0)
buf->update_needed = false;
} else {
kfifo_reset_out(&buf->kf);
}
Expand Down

0 comments on commit e5f1efb

Please sign in to comment.