diff options
author | Xiang Chen <chenxiang66@hisilicon.com> | 2019-10-22 02:27:08 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-10-24 20:34:10 -0400 |
commit | 0cf9f4e547cebb5f5d2d046437c71ddcc8ea4a39 (patch) | |
tree | 741faaddd2164a0a17f01fab377e4d5bf372026e | |
parent | fc5b220b2dcf8b512d9bd46fd17f82257e49bf89 (diff) |
scsi: sd: define variable dif as unsigned int instead of bool
Variable dif in function sd_setup_read_write_cmnd() is the return value of
function scsi_host_dif_capable() which returns dif capability of disks. If
define it as bool, even for the disks which support DIF3, the function
still return dif=1, which causes IO error. So define variable dif as
unsigned int instead of bool.
Fixes: e249e42d277e ("scsi: sd: Clean up sd_setup_read_write_cmnd()")
Link: https://lore.kernel.org/r/1571725628-132736-1-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/sd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 0f96eb0ddbfa..fe05475ce5dc 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1166,11 +1166,12 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd) | |||
1166 | sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq)); | 1166 | sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq)); |
1167 | sector_t threshold; | 1167 | sector_t threshold; |
1168 | unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq)); | 1168 | unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq)); |
1169 | bool dif, dix; | ||
1170 | unsigned int mask = logical_to_sectors(sdp, 1) - 1; | 1169 | unsigned int mask = logical_to_sectors(sdp, 1) - 1; |
1171 | bool write = rq_data_dir(rq) == WRITE; | 1170 | bool write = rq_data_dir(rq) == WRITE; |
1172 | unsigned char protect, fua; | 1171 | unsigned char protect, fua; |
1173 | blk_status_t ret; | 1172 | blk_status_t ret; |
1173 | unsigned int dif; | ||
1174 | bool dix; | ||
1174 | 1175 | ||
1175 | ret = scsi_init_io(cmd); | 1176 | ret = scsi_init_io(cmd); |
1176 | if (ret != BLK_STS_OK) | 1177 | if (ret != BLK_STS_OK) |