]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iio: buffer: correctly return bytes written in output buffers
authorNuno Sá <nuno.sa@analog.com>
Thu, 16 Feb 2023 10:14:50 +0000 (11:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Apr 2023 14:55:27 +0000 (16:55 +0200)
commit1658d973b2f8fffd93d6d2ef6967e7dd6d207883
tree4bfd86d18d167dd3776ce246d5136a35be380ea7
parent59d667d7ae4673657843b985297bec067f0ed856
iio: buffer: correctly return bytes written in output buffers

commit b5184a26a28fac1d708b0bfeeb958a9260c2924c upstream.

If for some reason 'rb->access->write()' does not write the full
requested data and the O_NONBLOCK is set, we would return 'n' to
userspace which is not really truth. Hence, let's return the number of
bytes we effectively wrote.

Fixes: 9eeee3b0bf190 ("iio: Add output buffer support")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20230216101452.591805-2-nuno.sa@analog.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/industrialio-buffer.c