summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-10-08 22:06:11 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2020-10-08 16:23:09 -0400
commitb6ba9b0e201a1c36972143366a3c22e672c43a61 (patch)
tree7595b673110e45a9cb25b609b243c5a2ca8d5e2f /drivers/scsi
parent9120ac54cce6c37de7580d7567119d28c8988ebc (diff)
downloadlinux-b6ba9b0e201a1c36972143366a3c22e672c43a61.tar.bz2
scsi: core: Set sc_data_direction to DMA_NONE for no-transfer commands
No having the special DMA_NONE logic makes libata rather unhappy. Link: https://lore.kernel.org/r/20201008200611.1818099-3-hch@lst.de Fixes: 40b93836a136 ("scsi: core: Use rq_dma_dir in scsi_setup_cmnd()") Reported-by: Qian Cai <cai@redhat.com> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6b0fccda9af2..1a2e9bab42ef 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1545,7 +1545,10 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
cmd->request = req;
cmd->tag = req->tag;
cmd->prot_op = SCSI_PROT_NORMAL;
- cmd->sc_data_direction = rq_dma_dir(req);
+ if (blk_rq_bytes(req))
+ cmd->sc_data_direction = rq_dma_dir(req);
+ else
+ cmd->sc_data_direction = DMA_NONE;
sg = (void *)cmd + sizeof(struct scsi_cmnd) + shost->hostt->cmd_size;
cmd->sdb.table.sgl = sg;