summaryrefslogtreecommitdiffstats
path: root/fs/splice.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-06-14 16:03:39 +0200
committerJens Axboe <axboe@kernel.dk>2023-06-16 10:08:08 -0600
commit2e82f6c3bfd1acde2610dd9feb4f2b264c4ef742 (patch)
tree8e0f5138315a2d8ac14c04658ced8b5b6415716a /fs/splice.c
parent0b24be4691c9e6ea13ca70050d42a9f9032fa788 (diff)
downloadlinux-2e82f6c3bfd1acde2610dd9feb4f2b264c4ef742.tar.gz
linux-2e82f6c3bfd1acde2610dd9feb4f2b264c4ef742.tar.bz2
linux-2e82f6c3bfd1acde2610dd9feb4f2b264c4ef742.zip
splice: simplify a conditional in copy_splice_read
Check for -EFAULT instead of wrapping the check in an ret < 0 block. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Christian Brauner <brauner@kernel.org> Reviewed-by: David Howells <dhowells@redhat.com> Link: https://lore.kernel.org/r/20230614140341.521331-3-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/splice.c')
-rw-r--r--fs/splice.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 87c69fdb333d..7a9565d8ec4f 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -368,15 +368,15 @@ ssize_t copy_splice_read(struct file *in, loff_t *ppos,
if (ret > 0) {
keep = DIV_ROUND_UP(ret, PAGE_SIZE);
*ppos = kiocb.ki_pos;
- } else if (ret < 0) {
- /*
- * callers of ->splice_read() expect -EAGAIN on
- * "can't put anything in there", rather than -EFAULT.
- */
- if (ret == -EFAULT)
- ret = -EAGAIN;
}
+ /*
+ * Callers of ->splice_read() expect -EAGAIN on "can't put anything in
+ * there", rather than -EFAULT.
+ */
+ if (ret == -EFAULT)
+ ret = -EAGAIN;
+
/* Free any pages that didn't get touched at all. */
if (keep < npages)
release_pages(pages + keep, npages - keep);