summaryrefslogtreecommitdiff
path: root/sys/dev/usb/if_mos.c
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2010-10-27 17:51:12 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2010-10-27 17:51:12 +0000
commit955c72c194bf7e82b4fff0dc198003d84bdd86b0 (patch)
treed36225e6b24e519f918b1ecaf995552ebf79287a /sys/dev/usb/if_mos.c
parent72c98d7491a3ceaf8fc8d6b18b3fa7c9664c0312 (diff)
don't free network related resources if they were not allocated
Diffstat (limited to 'sys/dev/usb/if_mos.c')
-rw-r--r--sys/dev/usb/if_mos.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/usb/if_mos.c b/sys/dev/usb/if_mos.c
index dcb085ad0bf..ffd9d662f84 100644
--- a/sys/dev/usb/if_mos.c
+++ b/sys/dev/usb/if_mos.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mos.c,v 1.10 2010/10/23 16:14:07 jakemsr Exp $ */
+/* $OpenBSD: if_mos.c,v 1.11 2010/10/27 17:51:11 jakemsr Exp $ */
/*
* Copyright (c) 2008 Johann Christian Rode <jcrode@gmx.net>
@@ -799,8 +799,10 @@ mos_detach(struct device *self, int flags)
mii_detach(&sc->mos_mii, MII_PHY_ANY, MII_OFFSET_ANY);
ifmedia_delete_instance(&sc->mos_mii.mii_media, IFM_INST_ANY);
- ether_ifdetach(ifp);
- if_detach(ifp);
+ if (ifp->if_softc != NULL) {
+ ether_ifdetach(ifp);
+ if_detach(ifp);
+ }
#ifdef DIAGNOSTIC
if (sc->mos_ep[MOS_ENDPT_TX] != NULL ||