aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2010-03-08 21:09:50 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-04-11 10:23:26 -0400
commitbb789d01620e5d36081b22edb6fb71cf55ff043c (patch)
tree1ca2bbbb878557edb209d87da6d90429faf38257 /drivers/scsi/mpt2sas
parentc4de0cebc512148bee764bfdac7bf49555e41173 (diff)
[SCSI] mpt2sas: fix the incorrect scsi_dma_map error checking
scsi_dma_map() returns -1 if an error occurred (zero means that the command has no data). So the following current code can't catch an error: sges_left = scsi_dma_map(scmd); if (!sges_left) { sdev_printk(KERN_ERR, scmd->device, "pci_map_sg" " failed: request for %d bytes!\n", scsi_bufflen(scmd)); return -ENOMEM; } Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index be171ed682e0..aa67b757bf23 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -988,7 +988,7 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
988 u32 chain_offset; 988 u32 chain_offset;
989 u32 chain_length; 989 u32 chain_length;
990 u32 chain_flags; 990 u32 chain_flags;
991 u32 sges_left; 991 int sges_left;
992 u32 sges_in_segment; 992 u32 sges_in_segment;
993 u32 sgl_flags; 993 u32 sgl_flags;
994 u32 sgl_flags_last_element; 994 u32 sgl_flags_last_element;
@@ -1009,7 +1009,7 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
1009 1009
1010 sg_scmd = scsi_sglist(scmd); 1010 sg_scmd = scsi_sglist(scmd);
1011 sges_left = scsi_dma_map(scmd); 1011 sges_left = scsi_dma_map(scmd);
1012 if (!sges_left) { 1012 if (sges_left < 0) {
1013 sdev_printk(KERN_ERR, scmd->device, "pci_map_sg" 1013 sdev_printk(KERN_ERR, scmd->device, "pci_map_sg"
1014 " failed: request for %d bytes!\n", scsi_bufflen(scmd)); 1014 " failed: request for %d bytes!\n", scsi_bufflen(scmd));
1015 return -ENOMEM; 1015 return -ENOMEM;