vserver 1.9.3
[linux-2.6.git] / drivers / net / hp100.c
index 78ae4b2..3c783a4 100644 (file)
@@ -2906,13 +2906,19 @@ static struct eisa_driver hp100_eisa_driver = {
 static int __devinit hp100_pci_probe (struct pci_dev *pdev,
                                     const struct pci_device_id *ent)
 {
-       struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private));
-       int ioaddr = pci_resource_start(pdev, 0);
+       struct net_device *dev;
+       int ioaddr;
        u_short pci_command;
        int err;
-       
-       if (!dev)
-               return -ENOMEM;
+
+       if (pci_enable_device(pdev))
+               return -ENODEV;
+
+       dev = alloc_etherdev(sizeof(struct hp100_private));
+       if (!dev) {
+               err = -ENOMEM;
+               goto out0;
+       }
 
        SET_MODULE_OWNER(dev);
        SET_NETDEV_DEV(dev, &pdev->dev);
@@ -2934,7 +2940,7 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev,
                pci_write_config_word(pdev, PCI_COMMAND, pci_command);
        }
        
-
+       ioaddr = pci_resource_start(pdev, 0);
        err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev);
        if (err) 
                goto out1;
@@ -2951,6 +2957,8 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev,
        release_region(dev->base_addr, HP100_REGION_SIZE);
  out1:
        free_netdev(dev);
+ out0:
+       pci_disable_device(pdev);
        return err;
 }
 
@@ -2959,6 +2967,7 @@ static void __devexit hp100_pci_remove (struct pci_dev *pdev)
        struct net_device *dev = pci_get_drvdata(pdev);
 
        cleanup_dev(dev);
+       pci_disable_device(pdev);
 }