diff options
author | Carl Delsey <carl@FreeBSD.org> | 2013-09-05 23:12:58 +0000 |
---|---|---|
committer | Carl Delsey <carl@FreeBSD.org> | 2013-09-05 23:12:58 +0000 |
commit | 538779c1a0b1c53731c5e749227ebc3035e4e8b4 (patch) | |
tree | a692ed9049f0a67a8e862b89a3a0840e8a480c27 /sys/dev/ntb/if_ntb/if_ntb.c | |
parent | 218b961f0ed4d31219d07b0d5cb18440c70d703a (diff) | |
download | src-538779c1a0b1c53731c5e749227ebc3035e4e8b4.tar.gz src-538779c1a0b1c53731c5e749227ebc3035e4e8b4.zip |
Only tear down interface and transport if they've been successfully setup.
Approved by: jimharris
Sponsored by: Intel
Notes
Notes:
svn path=/head/; revision=255280
Diffstat (limited to 'sys/dev/ntb/if_ntb/if_ntb.c')
-rw-r--r-- | sys/dev/ntb/if_ntb/if_ntb.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/ntb/if_ntb/if_ntb.c b/sys/dev/ntb/if_ntb/if_ntb.c index 510bd754945b..b74e6c2bb3ea 100644 --- a/sys/dev/ntb/if_ntb/if_ntb.c +++ b/sys/dev/ntb/if_ntb/if_ntb.c @@ -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); } |