aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/imm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/imm.c')
-rw-r--r--drivers/scsi/imm.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index a3d0c6b14958..f97d172844be 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -837,19 +837,16 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
837 837
838 /* Phase 4 - Setup scatter/gather buffers */ 838 /* Phase 4 - Setup scatter/gather buffers */
839 case 4: 839 case 4:
840 if (cmd->use_sg) { 840 if (scsi_bufflen(cmd)) {
841 /* if many buffers are available, start filling the first */ 841 cmd->SCp.buffer = scsi_sglist(cmd);
842 cmd->SCp.buffer =
843 (struct scatterlist *) cmd->request_buffer;
844 cmd->SCp.this_residual = cmd->SCp.buffer->length; 842 cmd->SCp.this_residual = cmd->SCp.buffer->length;
845 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); 843 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
846 } else { 844 } else {
847 /* else fill the only available buffer */
848 cmd->SCp.buffer = NULL; 845 cmd->SCp.buffer = NULL;
849 cmd->SCp.this_residual = cmd->request_bufflen; 846 cmd->SCp.this_residual = 0;
850 cmd->SCp.ptr = cmd->request_buffer; 847 cmd->SCp.ptr = NULL;
851 } 848 }
852 cmd->SCp.buffers_residual = cmd->use_sg - 1; 849 cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1;
853 cmd->SCp.phase++; 850 cmd->SCp.phase++;
854 if (cmd->SCp.this_residual & 0x01) 851 if (cmd->SCp.this_residual & 0x01)
855 cmd->SCp.this_residual++; 852 cmd->SCp.this_residual++;