提交 c82f63e4 编写于 作者: A Alek Du 提交者: Jesse Barnes

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: NRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: NAlek Du <alek.du@intel.com>
Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
上级 6c30c53f
...@@ -508,7 +508,7 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev) ...@@ -508,7 +508,7 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
return error; return error;
} }
return pci_dev->state_saved ? pci_restore_state(pci_dev) : 0; return pci_restore_state(pci_dev);
} }
static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev) static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
......
...@@ -846,6 +846,8 @@ pci_restore_state(struct pci_dev *dev) ...@@ -846,6 +846,8 @@ pci_restore_state(struct pci_dev *dev)
int i; int i;
u32 val; u32 val;
if (!dev->state_saved)
return 0;
/* PCI Express register must be restored first */ /* PCI Express register must be restored first */
pci_restore_pcie_state(dev); pci_restore_pcie_state(dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册