summaryrefslogtreecommitdiff
path: root/drivers/staging/rts5208
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2015-05-16 10:17:51 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-31 05:40:14 +0300
commit8ee0df0d0695f87075a77b0dc9f5f594b7ec423f (patch)
treecb0a7b655a2bee0b0a04c58a8e1962dd8ebd6311 /drivers/staging/rts5208
parent07d783fd830a49008f3b2764ae7b6033ee1bf329 (diff)
downloadlinux-8ee0df0d0695f87075a77b0dc9f5f594b7ec423f.tar.xz
staging: rts5208: fix transfer length 0 for 6-byte r/w commands
For 6-byte r/w commands, transfer length 0 means 256 blocks of data, not 0 block. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Micky Ching <micky_ching@realsil.com.cn> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-scsi@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rts5208')
-rw-r--r--drivers/staging/rts5208/rtsx_scsi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c
index 8a5d6a8e780f..60871f3022b1 100644
--- a/drivers/staging/rts5208/rtsx_scsi.c
+++ b/drivers/staging/rts5208/rtsx_scsi.c
@@ -915,6 +915,8 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip)
start_sec = ((u32)(srb->cmnd[1] & 0x1F) << 16) |
((u32)srb->cmnd[2] << 8) | ((u32)srb->cmnd[3]);
sec_cnt = srb->cmnd[4];
+ if (sec_cnt == 0)
+ sec_cnt = 256;
} else if ((srb->cmnd[0] == VENDOR_CMND) &&
(srb->cmnd[1] == SCSI_APP_CMD) &&
((srb->cmnd[2] == PP_READ10) || (srb->cmnd[2] == PP_WRITE10))) {
@@ -2904,9 +2906,11 @@ void led_shine(struct scsi_cmnd *srb, struct rtsx_chip *chip)
if ((srb->cmnd[0] == READ_10) || (srb->cmnd[0] == WRITE_10))
sec_cnt = ((u16)(srb->cmnd[7]) << 8) | srb->cmnd[8];
- else if ((srb->cmnd[0] == READ_6) || (srb->cmnd[0] == WRITE_6))
+ else if ((srb->cmnd[0] == READ_6) || (srb->cmnd[0] == WRITE_6)) {
sec_cnt = srb->cmnd[4];
- else
+ if (sec_cnt == 0)
+ sec_cnt = 256;
+ } else
return;
if (chip->rw_cap[lun] >= GPIO_TOGGLE_THRESHOLD) {