From patchwork Sat May 16 07:17:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 6419211 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 98F13C0432 for ; Sat, 16 May 2015 07:18:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC799204A7 for ; Sat, 16 May 2015 07:18:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 667D3204E3 for ; Sat, 16 May 2015 07:18:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932595AbbEPHSn (ORCPT ); Sat, 16 May 2015 03:18:43 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34456 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932859AbbEPHSk (ORCPT ); Sat, 16 May 2015 03:18:40 -0400 Received: by pabru16 with SMTP id ru16so53525190pab.1 for ; Sat, 16 May 2015 00:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=15pymc9Ag+pWDFN/TmHH4Y5SastkqEYw15+n63iNgeY=; b=uovVrxCjPd2rs1IOGLK0piP2VNoSHXHVcVTvqgbt6TukyowzfE/zN6QudDSI0YAsce QlxHuF1Ve9DN6tqmicbRFGG0CMFvMbYxzwX70v1HBObZbR5VeXfrAKYDIrTzj3T/EPrK Z2q7DbaACPCY8VwAp6VttwF6YBdxbrE6ABt3kXW3yChfA9CZQCepk8OKx51MnOqfZfUB hvtDutiW6bxIHEX0h8gLYSueggTF8/J8yFVJe4BsB4hbv5d+mE+5bL3oufKYFU7GM16S pkTolNIQQLuXTij36KUXrV0caUalKHq/dVfdGaQgKCSFdIDVU2fqWiomSadsPdNTkPvU IQEg== X-Received: by 10.68.167.162 with SMTP id zp2mr25147783pbb.105.1431760719733; Sat, 16 May 2015 00:18:39 -0700 (PDT) Received: from localhost.localdomain (KD106168100169.ppp-bb.dion.ne.jp. [106.168.100.169]) by mx.google.com with ESMTPSA id j14sm3804949pbq.29.2015.05.16.00.18.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 16 May 2015 00:18:38 -0700 (PDT) From: Akinobu Mita To: linux-scsi@vger.kernel.org, "James E.J. Bottomley" Cc: Akinobu Mita , Micky Ching , Greg Kroah-Hartman Subject: [PATCH 5/7] staging: rts5208: fix transfer length 0 for 6-byte r/w commands Date: Sat, 16 May 2015 16:17:51 +0900 Message-Id: <1431760673-7180-6-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431760673-7180-1-git-send-email-akinobu.mita@gmail.com> References: <1431760673-7180-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For 6-byte r/w commands, transfer length 0 means 256 blocks of data, not 0 block. Signed-off-by: Akinobu Mita Cc: Micky Ching Cc: Greg Kroah-Hartman Cc: linux-scsi@vger.kernel.org --- drivers/staging/rts5208/rtsx_scsi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c index 8a5d6a8..60871f3 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) {