Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2012 01:44:17 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r236865 - stable/9/sys/dev/ae
Message-ID:  <201206110144.q5B1iH1m034040@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Mon Jun 11 01:44:17 2012
New Revision: 236865
URL: http://svn.freebsd.org/changeset/base/236865

Log:
  MFC r236649,236670:
  
  Check the return value of pci_find_cap()

Modified:
  stable/9/sys/dev/ae/if_ae.c
Directory Properties:
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/ae/if_ae.c
==============================================================================
--- stable/9/sys/dev/ae/if_ae.c	Mon Jun 11 01:38:34 2012	(r236864)
+++ stable/9/sys/dev/ae/if_ae.c	Mon Jun 11 01:44:17 2012	(r236865)
@@ -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(sc->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?201206110144.q5B1iH1m034040>