diff options
author | Yojiro Uo <yuo@cvs.openbsd.org> | 2008-06-02 09:42:23 +0000 |
---|---|---|
committer | Yojiro Uo <yuo@cvs.openbsd.org> | 2008-06-02 09:42:23 +0000 |
commit | 1a400e339782a4d5517f12fd6f60f2943b546250 (patch) | |
tree | 5cbf15f9d353394070ea653413183e1c321992b7 /sys/dev/usb | |
parent | 68ab07e7c49d67530c8adb6ce5c9bbd475602b52 (diff) |
fix kernel freeze when the device unpluged (and the device was still active)
ok jsg@ pyr@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/umsm.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/usb/umsm.c b/sys/dev/usb/umsm.c index 924d1148600..993380be8a7 100644 --- a/sys/dev/usb/umsm.c +++ b/sys/dev/usb/umsm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umsm.c,v 1.28 2008/05/28 13:33:44 pyr Exp $ */ +/* $OpenBSD: umsm.c,v 1.29 2008/06/02 09:42:22 yuo Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -256,6 +256,14 @@ umsm_detach(struct device *self, int flags) struct umsm_softc *sc = (struct umsm_softc *)self; int rv = 0; + /* close the interrupt endpoint if that is opened */ + if (sc->sc_intr_pipe != NULL) { + usbd_abort_pipe(sc->sc_intr_pipe); + usbd_close_pipe(sc->sc_intr_pipe); + free(sc->sc_intr_buf, M_USBDEV); + sc->sc_intr_pipe = NULL; + } + sc->sc_dying = 1; if (sc->sc_subdev != NULL) { rv = config_detach(sc->sc_subdev, flags); |