mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Check the return value of pci_find_cap()
This commit is contained in:
parent
11e3340235
commit
858f9d27f0
1 changed files with 7 additions and 6 deletions
|
|
@ -1381,12 +1381,13 @@ ae_pm_init(ae_softc_t *sc)
|
|||
/*
|
||||
* Configure PME.
|
||||
*/
|
||||
pci_find_cap(sc->dev, PCIY_PMG, &pmc);
|
||||
pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2);
|
||||
pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
|
||||
if ((ifp->if_capenable & IFCAP_WOL) != 0)
|
||||
pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
|
||||
pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
|
||||
if (pci_find_cap(dev, PCIY_PMG, &pmc) == 0) {
|
||||
pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2);
|
||||
pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
|
||||
if ((ifp->if_capenable & IFCAP_WOL) != 0)
|
||||
pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
|
||||
pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Reference in a new issue