PCI PM: Check if the state has been saved before trying to restore it
Check if the standard configuration registers of a PCI device have
been saved during suspend before trying to restore them during
resume.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 4880755..87c9042 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1421,7 +1421,7 @@
dev->current_state = PCI_D0;
Restore:
- return pci_restore_state(dev);
+ return dev->state_saved ? pci_restore_state(dev) : 0;
}
/**