diff options
author | Alek Du <alek.du@intel.com> | 2009-08-07 20:46:19 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-08-20 12:08:45 -0400 |
commit | c82f63e411f1b58427c103bd95af2863b1c96dd1 (patch) | |
tree | 4a18447facd22c384c871e312cb3183c01a44b2c /drivers | |
parent | 6c30c53fd5ae6a99a23ad78e90c428d2c8ffb07f (diff) |
PCI: check saved state before restore
Without the check, the config space may be filled with zeros. Though
the driver should try to avoid call restoring before saving, but the
pci layer also should check this.
Also removes the existing check in pci_restore_standard_config, since
it's superfluous with the new check in restore_state.
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/pci-driver.c | 2 | ||||
-rw-r--r-- | drivers/pci/pci.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index d76c4c85367..f99bc7f089f 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -508,7 +508,7 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev) | |||
508 | return error; | 508 | return error; |
509 | } | 509 | } |
510 | 510 | ||
511 | return pci_dev->state_saved ? pci_restore_state(pci_dev) : 0; | 511 | return pci_restore_state(pci_dev); |
512 | } | 512 | } |
513 | 513 | ||
514 | static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev) | 514 | static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index dbd0f947f49..7b70312181d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -846,6 +846,8 @@ pci_restore_state(struct pci_dev *dev) | |||
846 | int i; | 846 | int i; |
847 | u32 val; | 847 | u32 val; |
848 | 848 | ||
849 | if (!dev->state_saved) | ||
850 | return 0; | ||
849 | /* PCI Express register must be restored first */ | 851 | /* PCI Express register must be restored first */ |
850 | pci_restore_pcie_state(dev); | 852 | pci_restore_pcie_state(dev); |
851 | 853 | ||