]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: core: Use scsi_cmd_priv() instead of open-coding it
authorBart Van Assche <bvanassche@acm.org>
Tue, 24 Jun 2025 21:05:40 +0000 (14:05 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 9 Jul 2025 02:11:42 +0000 (22:11 -0400)
Improve code readability without modifying the behavior of the code.

Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.g.garry@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250624210541.512910-4-bvanassche@acm.org
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c

index 144c72f0737a1e1367d854ecaf31b53ac1d08349..0c65ecfedfbd65c74819d660869994ce411a7bd0 100644 (file)
@@ -1843,7 +1843,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
         * a function to initialize that data.
         */
        if (shost->hostt->cmd_size && !shost->hostt->init_cmd_priv)
-               memset(cmd + 1, 0, shost->hostt->cmd_size);
+               memset(scsi_cmd_priv(cmd), 0, shost->hostt->cmd_size);
 
        if (!(req->rq_flags & RQF_DONTPREP)) {
                ret = scsi_prepare_cmd(req);