netxen: handle pci bar 0 mapping failure

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, March 2, 2009 - 5:00 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=028e14...
Commit:     028e1415a78733fcd2cba4b4c001826cc37a373e
Parent:     044fad0dbb4e814c061916fe5a36851af2fd1135
Author:     Dhananjay Phadke <dhananjay@netxen.com>
AuthorDate: Tue Feb 24 03:44:23 2009 -0800
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Tue Feb 24 03:44:23 2009 -0800

    netxen: handle pci bar 0 mapping failure
    
    PCI bar 0 is used for memory mapped register access.
    If ioremap fails (returns NULL), register access results
    in crash.
    
    Use pci_ioremap_bar() instead of ioremap(), the latter
    fails on on 32 bit powerpc where pci resource address is
    > 32 bits.
    
    Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/netxen/netxen_nic_main.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index f425811..1308778 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -588,7 +588,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		adapter->pci_mem_read = netxen_nic_pci_mem_read_2M;
 		adapter->pci_mem_write = netxen_nic_pci_mem_write_2M;
 
-		mem_ptr0 = ioremap(mem_base, mem_len);
+		mem_ptr0 = pci_ioremap_bar(pdev, 0);
+		if (mem_ptr0 == NULL) {
+			dev_err(&pdev->dev, "failed to map PCI bar 0\n");
+			return -EIO;
+		}
+
 		pci_len0 = mem_len;
 		first_page_group_start = 0;
 		first_page_group_end   = 0;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
netxen: handle pci bar 0 mapping failure, Linux Kernel Mailing ..., (Mon Mar 2, 5:00 pm)