Skip to content

Commit 6f9f0ee

Browse files
committed
PCI: PM: Fix ordering of operations in pci_back_from_sleep()
The ordering of operations in pci_back_from_sleep() is incorrect, because the device may be in D3cold when it runs and pci_enable_wake() needs to access the device's configuration space which cannot be done in D3cold. Fix this by calling pci_set_power_state() to put the device into D0 before calling pci_enable_wake() for it. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Bjorn Helgaas <[email protected]>
1 parent fa1a25c commit 6f9f0ee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/pci/pci.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2638,8 +2638,13 @@ EXPORT_SYMBOL(pci_prepare_to_sleep);
26382638
*/
26392639
int pci_back_from_sleep(struct pci_dev *dev)
26402640
{
2641+
int ret = pci_set_power_state(dev, PCI_D0);
2642+
2643+
if (ret)
2644+
return ret;
2645+
26412646
pci_enable_wake(dev, PCI_D0, false);
2642-
return pci_set_power_state(dev, PCI_D0);
2647+
return 0;
26432648
}
26442649
EXPORT_SYMBOL(pci_back_from_sleep);
26452650

0 commit comments

Comments
 (0)