From: Caleb Sander Mateos Date: Fri, 28 Mar 2025 18:04:08 +0000 (-0600) Subject: ublk: skip 1 NULL check in ublk_cmd_list_tw_cb() loop X-Git-Tag: v6.15-rc1~29^2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d7fa99189709b80eb16094aad18f7e492b835de;p=thirdparty%2Fkernel%2Fstable.git ublk: skip 1 NULL check in ublk_cmd_list_tw_cb() loop 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 Link: https://lore.kernel.org/r/20250328180411.2696494-3-csander@purestorage.com Signed-off-by: Jens Axboe --- diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 39efe443e2354..8b9780c0feab4 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -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)