Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 May 2012 21:09:04 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r235144 - head/sys/dev/tsec
Message-ID:  <201205082109.q48L94Vu052029@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Tue May  8 21:09:03 2012
New Revision: 235144
URL: http://svn.freebsd.org/changeset/base/235144

Log:
  The DEVICE_POLLING dereference of sc->tsec_ifp needs to be checked for null
  first or this will panic. Condense three blocks that check sc->tsec_ifp into
  one while I am here.

Modified:
  head/sys/dev/tsec/if_tsec.c

Modified: head/sys/dev/tsec/if_tsec.c
==============================================================================
--- head/sys/dev/tsec/if_tsec.c	Tue May  8 19:47:52 2012	(r235143)
+++ head/sys/dev/tsec/if_tsec.c	Tue May  8 21:09:03 2012	(r235144)
@@ -289,17 +289,17 @@ int
 tsec_detach(struct tsec_softc *sc)
 {
 
+	if (sc->tsec_ifp != NULL) {
 #ifdef DEVICE_POLLING
-	if (sc->tsec_ifp->if_capenable & IFCAP_POLLING)
-		ether_poll_deregister(sc->tsec_ifp);
+		if (sc->tsec_ifp->if_capenable & IFCAP_POLLING)
+			ether_poll_deregister(sc->tsec_ifp);
 #endif
 
-	/* Stop TSEC controller and free TX queue */
-	if (sc->sc_rres && sc->tsec_ifp)
-		tsec_shutdown(sc->dev);
+		/* Stop TSEC controller and free TX queue */
+		if (sc->sc_rres)
+			tsec_shutdown(sc->dev);
 
-	/* Detach network interface */
-	if (sc->tsec_ifp) {
+		/* Detach network interface */
 		ether_ifdetach(sc->tsec_ifp);
 		if_free(sc->tsec_ifp);
 		sc->tsec_ifp = NULL;



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