[PATCH] PCI: check if the state is saved before restoring it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The device state is restored twice by the PCI PM and device driver itself.
Before removing the pci_restore_state() from the device driver, we'd better
check the `state_saved' to avoid the second restore.

Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>
---
 drivers/pci/pci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 9376763..2b11810 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -762,6 +762,9 @@ pci_restore_state(struct pci_dev *dev)
 	int i;
 	u32 val;
 
+	if (!dev->state_saved)
+		return 0;
+
 	/* PCI Express register must be restored first */
 	pci_restore_pcie_state(dev);
 
-- 
1.5.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux