Skip to content

Commit cca03de

Browse files
Andrew Lunngregkh
authored andcommitted
PCI: pci_set_power_state(): check for PM capabilities earlier
Check for PCI_CAP_ID_PM before checking the device state. Apparently fixes some log spam via the 3c59x driver. Signed-off-by: Andrew Lunn <andrew.lunn@ascom.ch> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 0bec2c8 commit cca03de

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎drivers/pci/pci.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,13 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
406406
if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev))
407407
return 0;
408408

409+
/* find PCI PM capability in list */
410+
pm = pci_find_capability(dev, PCI_CAP_ID_PM);
411+
412+
/* abort if the device doesn't support PM capabilities */
413+
if (!pm)
414+
return -EIO;
415+
409416
/* Validate current state:
410417
* Can enter D0 from any state, but if we can only go deeper
411418
* to sleep if we're already in a low power state
@@ -418,13 +425,6 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
418425
return 0; /* we're already there */
419426

420427

421-
/* find PCI PM capability in list */
422-
pm = pci_find_capability(dev, PCI_CAP_ID_PM);
423-
424-
/* abort if the device doesn't support PM capabilities */
425-
if (!pm)
426-
return -EIO;
427-
428428
pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
429429
if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
430430
printk(KERN_DEBUG

0 commit comments

Comments
 (0)