diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2012-11-10 14:35:07 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2012-11-10 14:35:07 +0000 |
commit | 73788eb1706396fc6b5cf8129795ccf6abad4e02 (patch) | |
tree | 6a37c290e29f45085fb11804bd3a4cf54db07d53 /sys/dev/usb/if_athn_usb.c | |
parent | 13500205a48553d64cd76ca2b8fa1160368b1f9e (diff) |
add a flag indicating whether shared code was initialized so that we
can prevent calling athn_detach if it wasn't; suggestion and ok stsp
Diffstat (limited to 'sys/dev/usb/if_athn_usb.c')
-rw-r--r-- | sys/dev/usb/if_athn_usb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c index def833ef95d..27df663baaa 100644 --- a/sys/dev/usb/if_athn_usb.c +++ b/sys/dev/usb/if_athn_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_usb.c,v 1.8 2011/07/03 15:47:17 matthew Exp $ */ +/* $OpenBSD: if_athn_usb.c,v 1.9 2012/11/10 14:35:06 mikeb Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -289,7 +289,8 @@ athn_usb_detach(struct device *self, int flags) struct athn_usb_softc *usc = (struct athn_usb_softc *)self; struct athn_softc *sc = &usc->sc_sc; - athn_detach(sc); + if (usc->sc_athn_attached) + athn_detach(sc); /* Wait for all async commands to complete. */ athn_usb_wait_async(usc); @@ -347,6 +348,7 @@ athn_usb_attachhook(void *xsc) splx(s); return; } + usc->sc_athn_attached = 1; /* Override some operations for USB. */ ifp->if_ioctl = athn_usb_ioctl; ifp->if_start = athn_usb_start; |