summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2004-03-15 16:10:08 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2004-03-15 16:10:08 +0000
commitacd3e66cafa0180f0ab5606ede15de63cd302985 (patch)
treecc85a194467075d48c3177e5f05b39124912d74f /sys/dev
parent7d2ad665e9fc541d7ae5caded8dcf5a8482ec0fd (diff)
fix if(); error, also add missing error checks and close_pipe calls.
found and ok aaron@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_wi_usb.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c
index 023d110758d..556f962f801 100644
--- a/sys/dev/usb/if_wi_usb.c
+++ b/sys/dev/usb/if_wi_usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_usb.c,v 1.8 2004/02/27 17:30:50 henning Exp $ */
+/* $OpenBSD: if_wi_usb.c,v 1.9 2004/03/15 16:10:07 drahn Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
@@ -362,6 +362,7 @@ USB_DETACH(wi_usb)
struct ifnet *ifp = WI_GET_IFP(sc);
struct wi_softc *wsc = &sc->sc_wi;
int s;
+ int err;
sc->wi_usb_dying = 1;
if (sc->wi_thread_info != NULL) {
@@ -408,12 +409,45 @@ USB_DETACH(wi_usb)
sc->wi_usb_txmem[sc->wi_usb_nummem] = NULL;
}
- if (sc->wi_usb_ep[WI_USB_ENDPT_INTR] != NULL);
- usbd_abort_pipe(sc->wi_usb_ep[WI_USB_ENDPT_INTR]);
- if (sc->wi_usb_ep[WI_USB_ENDPT_TX] != NULL);
+ if (sc->wi_usb_ep[WI_USB_ENDPT_INTR] != NULL) {
+ err = usbd_abort_pipe(sc->wi_usb_ep[WI_USB_ENDPT_INTR]);
+ if (err) {
+ printf("%s: abort intr pipe failed: %s\n",
+ USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err));
+ }
+ err = usbd_close_pipe(sc->wi_usb_ep[WI_USB_ENDPT_INTR]);
+ if (err) {
+ printf("%s: close intr pipe failed: %s\n",
+ USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err));
+ }
+ sc->wi_usb_ep[WI_USB_ENDPT_INTR] = NULL;
+ }
+ if (sc->wi_usb_ep[WI_USB_ENDPT_TX] != NULL) {
usbd_abort_pipe(sc->wi_usb_ep[WI_USB_ENDPT_TX]);
- if (sc->wi_usb_ep[WI_USB_ENDPT_RX] != NULL);
+ if (err) {
+ printf("%s: abort tx pipe failed: %s\n",
+ USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err));
+ }
+ err = usbd_close_pipe(sc->wi_usb_ep[WI_USB_ENDPT_TX]);
+ if (err) {
+ printf("%s: close tx pipe failed: %s\n",
+ USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err));
+ }
+ sc->wi_usb_ep[WI_USB_ENDPT_TX] = NULL;
+ }
+ if (sc->wi_usb_ep[WI_USB_ENDPT_RX] != NULL) {
usbd_abort_pipe(sc->wi_usb_ep[WI_USB_ENDPT_RX]);
+ if (err) {
+ printf("%s: abort rx pipe failed: %s\n",
+ USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err));
+ }
+ err = usbd_close_pipe(sc->wi_usb_ep[WI_USB_ENDPT_RX]);
+ if (err) {
+ printf("%s: close rx pipe failed: %s\n",
+ USBDEVNAME(sc->wi_usb_dev), usbd_errstr(err));
+ }
+ sc->wi_usb_ep[WI_USB_ENDPT_RX] = NULL;
+ }
splx(s);