summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uoaklux.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-05-07 08:17:22 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-05-07 08:17:22 +0000
commitf42bbc1efedba08990ee2a1be6e7cd53b3cab676 (patch)
tree87208209e676aac2c1e548f57d9aa2db6836baa5 /sys/dev/usb/uoaklux.c
parent964a11a1c4d29543b78bc6aac4c1656c16d5ff16 (diff)
Make sure to call uhidev_close() upon detach for every HID driver calling
uhidev_open() at attach time. This plugs up to 3 xfer leaks and a buffer one. ok yuo@
Diffstat (limited to 'sys/dev/usb/uoaklux.c')
-rw-r--r--sys/dev/usb/uoaklux.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/usb/uoaklux.c b/sys/dev/usb/uoaklux.c
index ad0761b2367..9a3b2403cc4 100644
--- a/sys/dev/usb/uoaklux.c
+++ b/sys/dev/usb/uoaklux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uoaklux.c,v 1.7 2014/03/19 08:59:37 mpi Exp $ */
+/* $OpenBSD: uoaklux.c,v 1.8 2014/05/07 08:17:21 mpi Exp $ */
/*
* Copyright (c) 2012 Yojiro UO <yuo@nui.org>
@@ -208,6 +208,9 @@ uoaklux_detach(struct device *self, int flags)
if (sc->sc_sensortask != NULL)
sensor_task_unregister(sc->sc_sensortask);
+ if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
+ uhidev_close(&sc->sc_hdev);
+
if (scc->sc_ibuf != NULL) {
free(scc->sc_ibuf, M_USBDEV);
scc->sc_ibuf = NULL;