All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard A Lary <rlary@linux.vnet.ibm.com>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] mpt2sas: use correct pci_resource_flag for comparison with device pci ,resource
Date: Fri, 12 Mar 2010 15:27:06 -0800	[thread overview]
Message-ID: <4B9ACDCA.6080803@linux.vnet.ibm.com> (raw)

From: Richard A Lary <rlary@linux.vnet.ibm.com>

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>

---

Index: b/drivers/scsi/mpt2sas/mpt2sas_base.c
===================================================================
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1253,7 +1253,7 @@ mpt2sas_base_map_resources(struct MPT2SA
  	}

  	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 MPT2SA
  		} 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;
+				}
  			}
  		}
  	}


             reply	other threads:[~2010-03-12 23:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12 23:27 Richard A Lary [this message]
2010-03-30 10:48 ` [PATCH] mpt2sas: use correct pci_resource_flag for comparison with device pci ,resource Desai, Kashyap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B9ACDCA.6080803@linux.vnet.ibm.com \
    --to=rlary@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.