diff options
author | Richard A Lary <rlary@linux.vnet.ibm.com> | 2010-03-12 15:27:06 -0800 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 09:23:33 -0500 |
commit | fc193172e63af2c749e198816a1ee694dd6395e6 (patch) | |
tree | 1b5af76f7ecd59f74b0e2b726309c30c4946faa0 /drivers/scsi | |
parent | 4644efabde172808c0a8b6e3f17e4c204a4e52e7 (diff) |
[SCSI] mpt2sas: use correct pci_resource_flag for comparison
This patch replaces incorrect base address space flag with correct IO
resource flag. Also, performs check of memory resource to validate
resource before using.
Signed-off-by: Richard A Lary <rlary@linux.vnet.ibm.com>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_base.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index da4bfbf95a7a..fb886d099baf 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -1253,7 +1253,7 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc) } for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE; i++) { - if (pci_resource_flags(pdev, i) & PCI_BASE_ADDRESS_SPACE_IO) { + if (pci_resource_flags(pdev, i) & IORESOURCE_IO) { if (pio_sz) continue; pio_chip = (u64)pci_resource_start(pdev, i); @@ -1261,15 +1261,18 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc) } else { if (memap_sz) continue; - ioc->chip_phys = pci_resource_start(pdev, i); - chip_phys = (u64)ioc->chip_phys; - memap_sz = pci_resource_len(pdev, i); - ioc->chip = ioremap(ioc->chip_phys, memap_sz); - if (ioc->chip == NULL) { - printk(MPT2SAS_ERR_FMT "unable to map adapter " - "memory!\n", ioc->name); - r = -EINVAL; - goto out_fail; + /* verify memory resource is valid before using */ + if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) { + ioc->chip_phys = pci_resource_start(pdev, i); + chip_phys = (u64)ioc->chip_phys; + memap_sz = pci_resource_len(pdev, i); + ioc->chip = ioremap(ioc->chip_phys, memap_sz); + if (ioc->chip == NULL) { + printk(MPT2SAS_ERR_FMT "unable to map " + "adapter memory!\n", ioc->name); + r = -EINVAL; + goto out_fail; + } } } } |