Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jun 2012 02:42:31 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236649 - head/sys/dev/ae
Message-ID:  <201206060242.q562gVhJ063331@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Wed Jun  6 02:42:30 2012
New Revision: 236649
URL: http://svn.freebsd.org/changeset/base/236649

Log:
  Check the return value of pci_find_cap()

Modified:
  head/sys/dev/ae/if_ae.c

Modified: head/sys/dev/ae/if_ae.c
==============================================================================
--- head/sys/dev/ae/if_ae.c	Wed Jun  6 01:01:12 2012	(r236648)
+++ head/sys/dev/ae/if_ae.c	Wed Jun  6 02:42:30 2012	(r236649)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206060242.q562gVhJ063331>