[PATCH] PCI/PM: Only read PCI_PM_CTRL register when available

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

 



If the pm_cap of the PCI device is unset, do not read the
PCI_PM_CTRL register in pci_set_full_power_state().

Fixes: e200904b275c ("PCI/PM: Split pci_power_up()")
Signed-off-by: Feiyang Chen <chenfeiyang@xxxxxxxxxxx>
---
 drivers/pci/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 60230da957e0..d6671cefcfa7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1305,8 +1305,10 @@ static int pci_set_full_power_state(struct pci_dev *dev)
 	if (ret < 0)
 		return ret;
 
-	pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
-	dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK;
+	if (dev->pm_cap) {
+		pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
+		dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK;
+	}
 	if (dev->current_state != PCI_D0) {
 		pci_info_ratelimited(dev, "Refused to change power state from %s to D0\n",
 				     pci_power_name(dev->current_state));
-- 
2.39.3




[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