Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[sfrench/cifs-2.6.git] / drivers / net / wireless / iwlwifi / iwl-agn.c
index b35c8813bef43fe9173d8a5b88bf8d69241a29d1..129e2d330abb1f5e591786fe29a5f940fdb1282c 100644 (file)
@@ -3868,7 +3868,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
        err = iwl_eeprom_check_version(priv);
        if (err)
-               goto out_iounmap;
+               goto out_free_eeprom;
 
        /* extract MAC Address */
        iwl_eeprom_get_mac(priv, priv->mac_addr);
@@ -3945,6 +3945,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        return 0;
 
  out_remove_sysfs:
+       destroy_workqueue(priv->workqueue);
+       priv->workqueue = NULL;
        sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
  out_uninit_drv:
        iwl_uninit_drv(priv);
@@ -3953,8 +3955,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  out_iounmap:
        pci_iounmap(pdev, priv->hw_base);
  out_pci_release_regions:
-       pci_release_regions(pdev);
        pci_set_drvdata(pdev, NULL);
+       pci_release_regions(pdev);
  out_pci_disable_device:
        pci_disable_device(pdev);
  out_ieee80211_free_hw:
@@ -4042,6 +4044,19 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
                priv->is_open = 1;
        }
 
+       /* pci driver assumes state will be saved in this function.
+        * pci state is saved and device disabled when interface is
+        * stopped, so at this time pci device will always be disabled -
+        * whether interface was started or not. saving pci state now will
+        * cause saved state be that of a disabled device, which will cause
+        * problems during resume in that we will end up with a disabled device.
+        *
+        * indicate that the current saved state (from when interface was
+        * stopped) is valid. if interface was never up at time of suspend
+        * then the saved state will still be valid as it was saved during
+        * .probe. */
+       pdev->state_saved = true;
+
        pci_set_power_state(pdev, PCI_D3hot);
 
        return 0;