scsi: cxlflash: Drop unused sense buffers
This removes the unused sense buffer in read_cap16() and write_same16(). Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@ -339,7 +339,6 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli)
|
|||||||
struct scsi_sense_hdr sshdr;
|
struct scsi_sense_hdr sshdr;
|
||||||
u8 *cmd_buf = NULL;
|
u8 *cmd_buf = NULL;
|
||||||
u8 *scsi_cmd = NULL;
|
u8 *scsi_cmd = NULL;
|
||||||
u8 *sense_buf = NULL;
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int retry_cnt = 0;
|
int retry_cnt = 0;
|
||||||
@ -348,8 +347,7 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli)
|
|||||||
retry:
|
retry:
|
||||||
cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
|
cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
|
||||||
scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL);
|
scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL);
|
||||||
sense_buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
|
if (unlikely(!cmd_buf || !scsi_cmd)) {
|
||||||
if (unlikely(!cmd_buf || !scsi_cmd || !sense_buf)) {
|
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -364,7 +362,7 @@ retry:
|
|||||||
/* Drop the ioctl read semahpore across lengthy call */
|
/* Drop the ioctl read semahpore across lengthy call */
|
||||||
up_read(&cfg->ioctl_rwsem);
|
up_read(&cfg->ioctl_rwsem);
|
||||||
result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf,
|
result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf,
|
||||||
CMD_BUFSIZE, sense_buf, &sshdr, to, CMD_RETRIES,
|
CMD_BUFSIZE, NULL, &sshdr, to, CMD_RETRIES,
|
||||||
0, 0, NULL);
|
0, 0, NULL);
|
||||||
down_read(&cfg->ioctl_rwsem);
|
down_read(&cfg->ioctl_rwsem);
|
||||||
rc = check_state(cfg);
|
rc = check_state(cfg);
|
||||||
@ -395,7 +393,6 @@ retry:
|
|||||||
if (retry_cnt++ < 1) {
|
if (retry_cnt++ < 1) {
|
||||||
kfree(cmd_buf);
|
kfree(cmd_buf);
|
||||||
kfree(scsi_cmd);
|
kfree(scsi_cmd);
|
||||||
kfree(sense_buf);
|
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -426,7 +423,6 @@ retry:
|
|||||||
out:
|
out:
|
||||||
kfree(cmd_buf);
|
kfree(cmd_buf);
|
||||||
kfree(scsi_cmd);
|
kfree(scsi_cmd);
|
||||||
kfree(sense_buf);
|
|
||||||
|
|
||||||
dev_dbg(dev, "%s: maxlba=%lld blklen=%d rc=%d\n",
|
dev_dbg(dev, "%s: maxlba=%lld blklen=%d rc=%d\n",
|
||||||
__func__, gli->max_lba, gli->blk_len, rc);
|
__func__, gli->max_lba, gli->blk_len, rc);
|
||||||
|
@ -426,7 +426,6 @@ static int write_same16(struct scsi_device *sdev,
|
|||||||
{
|
{
|
||||||
u8 *cmd_buf = NULL;
|
u8 *cmd_buf = NULL;
|
||||||
u8 *scsi_cmd = NULL;
|
u8 *scsi_cmd = NULL;
|
||||||
u8 *sense_buf = NULL;
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
u64 offset = lba;
|
u64 offset = lba;
|
||||||
@ -440,8 +439,7 @@ static int write_same16(struct scsi_device *sdev,
|
|||||||
|
|
||||||
cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
|
cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
|
||||||
scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL);
|
scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL);
|
||||||
sense_buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
|
if (unlikely(!cmd_buf || !scsi_cmd)) {
|
||||||
if (unlikely(!cmd_buf || !scsi_cmd || !sense_buf)) {
|
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -457,7 +455,7 @@ static int write_same16(struct scsi_device *sdev,
|
|||||||
/* Drop the ioctl read semahpore across lengthy call */
|
/* Drop the ioctl read semahpore across lengthy call */
|
||||||
up_read(&cfg->ioctl_rwsem);
|
up_read(&cfg->ioctl_rwsem);
|
||||||
result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf,
|
result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf,
|
||||||
CMD_BUFSIZE, sense_buf, NULL, to,
|
CMD_BUFSIZE, NULL, NULL, to,
|
||||||
CMD_RETRIES, 0, 0, NULL);
|
CMD_RETRIES, 0, 0, NULL);
|
||||||
down_read(&cfg->ioctl_rwsem);
|
down_read(&cfg->ioctl_rwsem);
|
||||||
rc = check_state(cfg);
|
rc = check_state(cfg);
|
||||||
@ -482,7 +480,6 @@ static int write_same16(struct scsi_device *sdev,
|
|||||||
out:
|
out:
|
||||||
kfree(cmd_buf);
|
kfree(cmd_buf);
|
||||||
kfree(scsi_cmd);
|
kfree(scsi_cmd);
|
||||||
kfree(sense_buf);
|
|
||||||
dev_dbg(dev, "%s: returning rc=%d\n", __func__, rc);
|
dev_dbg(dev, "%s: returning rc=%d\n", __func__, rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user