summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkevlo <kevlo@FreeBSD.org>2012-06-06 02:42:30 +0000
committerkevlo <kevlo@FreeBSD.org>2012-06-06 02:42:30 +0000
commit189fa08e47a3906066f9b390ce70cd71487ca409 (patch)
treed2c9d763339a773e835288744baa5259371899bd
parent17a0246939494f40a3aae8312fe12157f19b2068 (diff)
downloadFreeBSD-src-189fa08e47a3906066f9b390ce70cd71487ca409.zip
FreeBSD-src-189fa08e47a3906066f9b390ce70cd71487ca409.tar.gz
Check the return value of pci_find_cap()
-rw-r--r--sys/dev/ae/if_ae.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/ae/if_ae.c b/sys/dev/ae/if_ae.c
index 3b882ee..9e10780 100644
--- a/sys/dev/ae/if_ae.c
+++ b/sys/dev/ae/if_ae.c
@@ -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
OpenPOWER on IntegriCloud