diff options
author | Keith Busch <kbusch@kernel.org> | 2025-02-24 13:31:06 -0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-02-27 07:17:39 -0700 |
commit | c5b47d5a8c0d3c657751f803295213284f432672 (patch) | |
tree | b930229502267954224b84df5834fe513a68e9c9 | |
parent | 7a9b0d6925b2b13640a94ca6e72a753bb39526b2 (diff) |
io_uring/rsrc: remove redundant check for valid imu
The only caller to io_buffer_unmap already checks if the node's buf is
not null, so no need to check again.
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250224213116.3509093-2-kbusch@meta.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | io_uring/rsrc.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index af39b69eb4fd..f3a41132a966 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -103,19 +103,16 @@ static int io_buffer_validate(struct iovec *iov) static void io_buffer_unmap(struct io_ring_ctx *ctx, struct io_rsrc_node *node) { + struct io_mapped_ubuf *imu = node->buf; unsigned int i; - if (node->buf) { - struct io_mapped_ubuf *imu = node->buf; - - if (!refcount_dec_and_test(&imu->refs)) - return; - for (i = 0; i < imu->nr_bvecs; i++) - unpin_user_page(imu->bvec[i].bv_page); - if (imu->acct_pages) - io_unaccount_mem(ctx, imu->acct_pages); - kvfree(imu); - } + if (!refcount_dec_and_test(&imu->refs)) + return; + for (i = 0; i < imu->nr_bvecs; i++) + unpin_user_page(imu->bvec[i].bv_page); + if (imu->acct_pages) + io_unaccount_mem(ctx, imu->acct_pages); + kvfree(imu); } struct io_rsrc_node *io_rsrc_node_alloc(int type) |