[PATCH] Handle pci_enable_device() errors in resume
authorValerie Henson <val_henson@linux.intel.com>
Fri, 8 Sep 2006 18:15:41 +0000 (11:15 -0700)
committerJeff Garzik <jeff@garzik.org>
Mon, 11 Sep 2006 13:05:37 +0000 (09:05 -0400)
Signed-off-by: Valerie Henson <val_henson@linux.intel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/tulip/de2104x.c
drivers/net/tulip/tulip_core.c
drivers/net/tulip/winbond-840.c

index 350a73e99a852eeb5674e24e753081c6b2eafed4..17a2ebaef58cf78a2a1baf92977dc10ca2ab70be 100644 (file)
@@ -2138,17 +2138,21 @@ static int de_resume (struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata (pdev);
        struct de_private *de = dev->priv;
+       int retval = 0;
 
        rtnl_lock();
        if (netif_device_present(dev))
                goto out;
-       if (netif_running(dev)) {
-               pci_enable_device(pdev);
-               de_init_hw(de);
-               netif_device_attach(dev);
-       } else {
-               netif_device_attach(dev);
+       if (!netif_running(dev))
+               goto out_attach;
+       if ((retval = pci_enable_device(pdev))) {
+               printk (KERN_ERR "%s: pci_enable_device failed in resume\n",
+                       dev->name);
+               goto out;
        }
+       de_init_hw(de);
+out_attach:
+       netif_device_attach(dev);
 out:
        rtnl_unlock();
        return 0;
index def5999f987b55462e25c04b2e6155a2faa37698..8092c4f8c03642d60a7dae84dae9f1480e40061e 100644 (file)
@@ -1769,7 +1769,10 @@ static int tulip_resume(struct pci_dev *pdev)
        pci_set_power_state(pdev, PCI_D0);
        pci_restore_state(pdev);
 
-       pci_enable_device(pdev);
+       if ((retval = pci_enable_device(pdev))) {
+               printk (KERN_ERR "tulip: pci_enable_device failed in resume\n");
+               return retval;
+       }
 
        if ((retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev))) {
                printk (KERN_ERR "tulip: request_irq failed in resume\n");
index b54378fac8f0beec30b42124c4703053fcbdfa60..a64d6828d9aa694b8e406ef87fb7e582b81df541 100644 (file)
@@ -1626,14 +1626,18 @@ static int w840_resume (struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata (pdev);
        struct netdev_private *np = netdev_priv(dev);
+       int retval = 0;
 
        rtnl_lock();
        if (netif_device_present(dev))
                goto out; /* device not suspended */
        if (netif_running(dev)) {
-               pci_enable_device(pdev);
-       /*      pci_power_on(pdev); */
-
+               if ((retval = pci_enable_device(pdev))) {
+                       printk (KERN_ERR
+                               "%s: pci_enable_device failed in resume\n",
+                               dev->name);
+                       goto out;
+               }
                spin_lock_irq(&np->lock);
                iowrite32(1, np->base_addr+PCIBusCfg);
                ioread32(np->base_addr+PCIBusCfg);
@@ -1651,7 +1655,7 @@ static int w840_resume (struct pci_dev *pdev)
        }
 out:
        rtnl_unlock();
-       return 0;
+       return retval;
 }
 #endif