diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2015-03-02 13:13:52 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2015-03-02 13:13:52 +0000 |
commit | 5b4df1f95dfa8c04c5e90af60282ed87355968d9 (patch) | |
tree | edac240472ca934f2043bf14f7e237090836e6a1 /sys/dev | |
parent | c094eb874b0be105eb5d67799e3146ee17f3f4ab (diff) |
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@
Diffstat (limited to 'sys/dev')
-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 |