Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dhananjay Phadke and committed by
David S. Miller
028e1415 044fad0d

+6 -1
+6 -1
drivers/net/netxen/netxen_nic_main.c
··· 588 588 adapter->pci_mem_read = netxen_nic_pci_mem_read_2M; 589 589 adapter->pci_mem_write = netxen_nic_pci_mem_write_2M; 590 590 591 - mem_ptr0 = ioremap(mem_base, mem_len); 591 + mem_ptr0 = pci_ioremap_bar(pdev, 0); 592 + if (mem_ptr0 == NULL) { 593 + dev_err(&pdev->dev, "failed to map PCI bar 0\n"); 594 + return -EIO; 595 + } 596 + 592 597 pci_len0 = mem_len; 593 598 first_page_group_start = 0; 594 599 first_page_group_end = 0;