Commit 9f28b416 authored by Randy Dunlap's avatar Randy Dunlap Committed by Jeff Garzik

[netdrvr natsemi] janitor: insert missing iounmap(), add error handling

From: Leann Ogasawara <ogasawara@osdl.org>

Patch inserts a missing iounmap().  Implements a cleanup path
for error handling as well.
parent 4576b4fa
...@@ -765,19 +765,13 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, ...@@ -765,19 +765,13 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
i = pci_request_regions(pdev, dev->name); i = pci_request_regions(pdev, dev->name);
if (i) { if (i)
free_netdev(dev); goto err_pci_request_regions;
return i;
}
{ ioaddr = (unsigned long) ioremap (ioaddr, iosize);
void *mmio = ioremap (ioaddr, iosize); if (!ioaddr) {
if (!mmio) { i = -ENOMEM;
pci_release_regions(pdev); goto err_ioremap;
free_netdev(dev);
return -ENOMEM;
}
ioaddr = (unsigned long) mmio;
} }
/* Work around the dropped serial bit. */ /* Work around the dropped serial bit. */
...@@ -835,13 +829,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, ...@@ -835,13 +829,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
dev->mtu = mtu; dev->mtu = mtu;
i = register_netdev(dev); i = register_netdev(dev);
if (i) { if (i)
pci_release_regions(pdev); goto err_register_netdev;
unregister_netdev(dev);
free_netdev(dev);
pci_set_drvdata(pdev, NULL);
return i;
}
netif_carrier_off(dev); netif_carrier_off(dev);
if (netif_msg_drv(np)) { if (netif_msg_drv(np)) {
...@@ -878,6 +868,17 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, ...@@ -878,6 +868,17 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
return 0; return 0;
err_register_netdev:
iounmap ((void *) dev->base_addr);
err_ioremap:
pci_release_regions(pdev);
pci_set_drvdata(pdev, NULL);
err_pci_request_regions:
free_netdev(dev);
return i;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment