]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ublk: skip 1 NULL check in ublk_cmd_list_tw_cb() loop
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 28 Mar 2025 18:04:08 +0000 (12:04 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 28 Mar 2025 22:15:43 +0000 (16:15 -0600)
ublk_cmd_list_tw_cb() is always performed on a non-empty request list.
So don't check whether rq is NULL on the first iteration of the loop,
just on subsequent iterations.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Link: https://lore.kernel.org/r/20250328180411.2696494-3-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c

index 39efe443e235480ea28b9cdf9b1366ee085e9ab8..8b9780c0feab4a0e8feb5c7c01dcf4088b466745 100644 (file)
@@ -1290,12 +1290,12 @@ static void ublk_cmd_list_tw_cb(struct io_uring_cmd *cmd,
        struct ublk_queue *ubq = rq->mq_hctx->driver_data;
        struct request *next;
 
-       while (rq) {
+       do {
                next = rq->rq_next;
                rq->rq_next = NULL;
                ublk_dispatch_req(ubq, rq, issue_flags);
                rq = next;
-       }
+       } while (rq);
 }
 
 static void ublk_queue_cmd_list(struct ublk_queue *ubq, struct rq_list *l)