Commit dcea0bfb authored by Gilad Broner's avatar Gilad Broner Committed by Martin K. Petersen

scsi: ufs: fix sense buffer size to 18 bytes

According to UFS device specification, sense data can be only 18 bytes
long, this change makes the changes accordingly.
Signed-off-by: default avatarGilad Broner <gbroner@codeaurora.org>
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ad1a1b9c
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#include "ufs_quirks.h" #include "ufs_quirks.h"
#include "unipro.h" #include "unipro.h"
#define UFSHCD_REQ_SENSE_SIZE 18
#define UFSHCD_ENABLE_INTRS (UTP_TRANSFER_REQ_COMPL |\ #define UFSHCD_ENABLE_INTRS (UTP_TRANSFER_REQ_COMPL |\
UTP_TASK_REQ_COMPL |\ UTP_TASK_REQ_COMPL |\
UFSHCD_ERROR_MASK) UFSHCD_ERROR_MASK)
...@@ -898,7 +900,7 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp) ...@@ -898,7 +900,7 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp)
memcpy(lrbp->sense_buffer, memcpy(lrbp->sense_buffer,
lrbp->ucd_rsp_ptr->sr.sense_data, lrbp->ucd_rsp_ptr->sr.sense_data,
min_t(int, len_to_copy, SCSI_SENSE_BUFFERSIZE)); min_t(int, len_to_copy, UFSHCD_REQ_SENSE_SIZE));
} }
} }
...@@ -1463,7 +1465,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) ...@@ -1463,7 +1465,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
WARN_ON(lrbp->cmd); WARN_ON(lrbp->cmd);
lrbp->cmd = cmd; lrbp->cmd = cmd;
lrbp->sense_bufflen = SCSI_SENSE_BUFFERSIZE; lrbp->sense_bufflen = UFSHCD_REQ_SENSE_SIZE;
lrbp->sense_buffer = cmd->sense_buffer; lrbp->sense_buffer = cmd->sense_buffer;
lrbp->task_tag = tag; lrbp->task_tag = tag;
lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun);
...@@ -5594,19 +5596,19 @@ ufshcd_send_request_sense(struct ufs_hba *hba, struct scsi_device *sdp) ...@@ -5594,19 +5596,19 @@ ufshcd_send_request_sense(struct ufs_hba *hba, struct scsi_device *sdp)
0, 0,
0, 0,
0, 0,
SCSI_SENSE_BUFFERSIZE, UFSHCD_REQ_SENSE_SIZE,
0}; 0};
char *buffer; char *buffer;
int ret; int ret;
buffer = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); buffer = kzalloc(UFSHCD_REQ_SENSE_SIZE, GFP_KERNEL);
if (!buffer) { if (!buffer) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
ret = scsi_execute_req_flags(sdp, cmd, DMA_FROM_DEVICE, buffer, ret = scsi_execute_req_flags(sdp, cmd, DMA_FROM_DEVICE, buffer,
SCSI_SENSE_BUFFERSIZE, NULL, UFSHCD_REQ_SENSE_SIZE, NULL,
msecs_to_jiffies(1000), 3, NULL, REQ_PM); msecs_to_jiffies(1000), 3, NULL, REQ_PM);
if (ret) if (ret)
pr_err("%s: failed with err %d\n", __func__, ret); pr_err("%s: failed with err %d\n", __func__, ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment