3c59x: handle pci_iomap() errors
authorKulikov Vasiliy <segooon@gmail.com>
Wed, 21 Jul 2010 02:00:36 +0000 (02:00 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Jul 2010 21:07:36 +0000 (14:07 -0700)
pci_iomap() can fail, handle this case and return -ENOMEM from probe
function.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/3c59x.c

index 069a03f717d304e1c9e2b1e0387181b612118661..9b137e14dbb0a9b3817b80a3f8df1460175b2a60 100644 (file)
@@ -1020,6 +1020,11 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,
        ioaddr = pci_iomap(pdev, pci_bar, 0);
        if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */
                ioaddr = pci_iomap(pdev, 0, 0);
+       if (!ioaddr) {
+               pci_disable_device(pdev);
+               rc = -ENOMEM;
+               goto out;
+       }
 
        rc = vortex_probe1(&pdev->dev, ioaddr, pdev->irq,
                           ent->driver_data, unit);