diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2010-03-09 11:09:50 +0900 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-03-14 10:57:51 -0400 |
commit | 9d30e342aba315aa777d00a5c681179de24a0f04 (patch) | |
tree | 51fa10ba5b1e5cc2cacca76a1f0db304a859557d | |
parent | da3a3ee57bc3af9c5c89b62cf79c2117b22a5597 (diff) | |
download | lwn-9d30e342aba315aa777d00a5c681179de24a0f04.tar.gz lwn-9d30e342aba315aa777d00a5c681179de24a0f04.zip |
mpt2sas: fix the incorrect scsi_dma_map error checking
commit bb789d01620e5d36081b22edb6fb71cf55ff043c upstream.
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>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_scsih.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 87cf0d2fafbc..8d98f090e7f2 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, u32 chain_offset; u32 chain_length; u32 chain_flags; - u32 sges_left; + int sges_left; u32 sges_in_segment; u32 sgl_flags; u32 sgl_flags_last_element; @@ -1009,7 +1009,7 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc, sg_scmd = scsi_sglist(scmd); sges_left = scsi_dma_map(scmd); - if (!sges_left) { + if (sges_left < 0) { sdev_printk(KERN_ERR, scmd->device, "pci_map_sg" " failed: request for %d bytes!\n", scsi_bufflen(scmd)); return -ENOMEM; |