diff options
author | 2015-03-02 13:13:51 +0000 | |
---|---|---|
committer | 2015-03-02 13:13:51 +0000 | |
commit | 1b4b7f678262b2aa4cef4aa282858098eb6aaf97 (patch) | |
tree | 883f0e3f74ec4bb5796e57b5d55e8b487ee6b906 | |
parent | Teach athn(4) about USB reference counting to prevent it from causing major (diff) | |
download | wireguard-openbsd-1b4b7f678262b2aa4cef4aa282858098eb6aaf97.tar.xz wireguard-openbsd-1b4b7f678262b2aa4cef4aa282858098eb6aaf97.zip |
In athn(4), set USB pipe pointers to NULL after closing pipes. Not really
required since this code runs during device detach but looks prettier.
Also remove an unneeded call to usbd_abort_pipe() which is implied by
usbd_close_pipe().
ok mpi@
-rw-r--r-- | sys/dev/usb/if_athn_usb.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c index 4d67266c5d4..de66c8040fb 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.27 2015/03/02 13:08:18 stsp Exp $ */ +/* $OpenBSD: if_athn_usb.c,v 1.28 2015/03/02 13:13:51 stsp Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr> @@ -438,18 +438,26 @@ athn_usb_open_pipes(struct athn_usb_softc *usc) void athn_usb_close_pipes(struct athn_usb_softc *usc) { - if (usc->tx_data_pipe != NULL) + if (usc->tx_data_pipe != NULL) { usbd_close_pipe(usc->tx_data_pipe); - if (usc->rx_data_pipe != NULL) + usc->tx_data_pipe = NULL; + } + if (usc->rx_data_pipe != NULL) { usbd_close_pipe(usc->rx_data_pipe); - if (usc->tx_intr_pipe != NULL) + usc->rx_data_pipe = NULL; + } + if (usc->tx_intr_pipe != NULL) { usbd_close_pipe(usc->tx_intr_pipe); + usc->tx_intr_pipe = NULL; + } if (usc->rx_intr_pipe != NULL) { - usbd_abort_pipe(usc->rx_intr_pipe); usbd_close_pipe(usc->rx_intr_pipe); + usc->rx_intr_pipe = NULL; } - if (usc->ibuf != NULL) + if (usc->ibuf != NULL) { free(usc->ibuf, M_USBDEV, 0); + usc->ibuf = NULL; + } } int |