Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Sep 2013 23:12:58 +0000 (UTC)
From:      Carl Delsey <carl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255280 - head/sys/dev/ntb/if_ntb
Message-ID:  <201309052312.r85NCwt8085395@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: carl
Date: Thu Sep  5 23:12:58 2013
New Revision: 255280
URL: http://svnweb.freebsd.org/changeset/base/255280

Log:
  Only tear down interface and transport if they've been successfully setup.
  
  Approved by:	jimharris
  Sponsored by:	Intel

Modified:
  head/sys/dev/ntb/if_ntb/if_ntb.c

Modified: head/sys/dev/ntb/if_ntb/if_ntb.c
==============================================================================
--- head/sys/dev/ntb/if_ntb/if_ntb.c	Thu Sep  5 23:11:11 2013	(r255279)
+++ head/sys/dev/ntb/if_ntb/if_ntb.c	Thu Sep  5 23:12:58 2013	(r255280)
@@ -334,14 +334,19 @@ ntb_setup_interface()
 static int
 ntb_teardown_interface()
 {
-	struct ifnet *ifp = net_softc.ifp;
 
-	ntb_transport_link_down(net_softc.qp);
+	if (net_softc.qp != NULL)
+		ntb_transport_link_down(net_softc.qp);
 
-	ether_ifdetach(ifp);
-	if_free(ifp);
-	ntb_transport_free_queue(net_softc.qp);
-	ntb_transport_free(&net_softc);
+	if (net_softc.ifp != NULL) {
+		ether_ifdetach(net_softc.ifp);
+		if_free(net_softc.ifp);
+	}
+
+	if (net_softc.qp != NULL) {
+		ntb_transport_free_queue(net_softc.qp);
+		ntb_transport_free(&net_softc);
+	}
 
 	return (0);
 }



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