usb: usbd_close_pipe never fails. Make it return void.

Prune dead branches as a result of this change.
This commit is contained in:
riastradh 2022-03-03 06:06:52 +00:00
parent 065aa2e999
commit 40e1019ee6
6 changed files with 20 additions and 41 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_atu.c,v 1.74 2022/03/03 06:05:38 riastradh Exp $ */
/* $NetBSD: if_atu.c,v 1.75 2022/03/03 06:06:52 riastradh Exp $ */
/* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */
/*
* Copyright (c) 2003, 2004
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.74 2022/03/03 06:05:38 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.75 2022/03/03 06:06:52 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -2223,7 +2223,6 @@ atu_stop(struct ifnet *ifp, int disable)
struct atu_softc *sc = ifp->if_softc;
struct ieee80211com *ic = &sc->sc_ic;
struct atu_cdata *cd;
usbd_status err;
int s;
s = splnet();
@ -2249,20 +2248,12 @@ atu_stop(struct ifnet *ifp, int disable)
/* Close pipes */
if (sc->atu_ep[ATU_ENDPT_RX] != NULL) {
err = usbd_close_pipe(sc->atu_ep[ATU_ENDPT_RX]);
if (err) {
DPRINTF(("%s: close rx pipe failed: %s\n",
device_xname(sc->atu_dev), usbd_errstr(err)));
}
usbd_close_pipe(sc->atu_ep[ATU_ENDPT_RX]);
sc->atu_ep[ATU_ENDPT_RX] = NULL;
}
if (sc->atu_ep[ATU_ENDPT_TX] != NULL) {
err = usbd_close_pipe(sc->atu_ep[ATU_ENDPT_TX]);
if (err) {
DPRINTF(("%s: close tx pipe failed: %s\n",
device_xname(sc->atu_dev), usbd_errstr(err)));
}
usbd_close_pipe(sc->atu_ep[ATU_ENDPT_TX]);
sc->atu_ep[ATU_ENDPT_TX] = NULL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_urtw.c,v 1.25 2021/12/31 14:25:24 riastradh Exp $ */
/* $NetBSD: if_urtw.c,v 1.26 2022/03/03 06:06:52 riastradh Exp $ */
/* $OpenBSD: if_urtw.c,v 1.39 2011/07/03 15:47:17 matthew Exp $ */
/*-
@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_urtw.c,v 1.25 2021/12/31 14:25:24 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_urtw.c,v 1.26 2022/03/03 06:06:52 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -829,24 +829,17 @@ urtw_close_pipes(struct urtw_softc *sc)
usbd_status error = 0;
if (sc->sc_rxpipe != NULL) {
error = usbd_close_pipe(sc->sc_rxpipe);
if (error != 0)
goto fail;
usbd_close_pipe(sc->sc_rxpipe);
sc->sc_rxpipe = NULL;
}
if (sc->sc_txpipe_low != NULL) {
error = usbd_close_pipe(sc->sc_txpipe_low);
if (error != 0)
goto fail;
usbd_close_pipe(sc->sc_txpipe_low);
sc->sc_txpipe_low = NULL;
}
if (sc->sc_txpipe_normal != NULL) {
error = usbd_close_pipe(sc->sc_txpipe_normal);
if (error != 0)
goto fail;
usbd_close_pipe(sc->sc_txpipe_normal);
sc->sc_txpipe_normal = NULL;
}
fail:
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ualea.c,v 1.14 2022/03/03 06:05:38 riastradh Exp $ */
/* $NetBSD: ualea.c,v 1.15 2022/03/03 06:06:52 riastradh Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.14 2022/03/03 06:05:38 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.15 2022/03/03 06:06:52 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@ -168,7 +168,7 @@ ualea_detach(device_t self, int flags)
if (sc->sc_xfer)
usbd_destroy_xfer(sc->sc_xfer);
if (sc->sc_pipe)
(void)usbd_close_pipe(sc->sc_pipe);
usbd_close_pipe(sc->sc_pipe);
mutex_destroy(&sc->sc_lock);
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbdi.c,v 1.224 2022/03/03 06:05:38 riastradh Exp $ */
/* $NetBSD: usbdi.c,v 1.225 2022/03/03 06:06:52 riastradh Exp $ */
/*
* Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.224 2022/03/03 06:05:38 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.225 2022/03/03 06:06:52 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -321,7 +321,7 @@ usbd_open_pipe_intr(struct usbd_interface *iface, uint8_t address,
return err;
}
usbd_status
void
usbd_close_pipe(struct usbd_pipe *pipe)
{
USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
@ -348,8 +348,6 @@ usbd_close_pipe(struct usbd_pipe *pipe)
if (pipe->up_iface)
usbd_iface_pipeunref(pipe->up_iface);
kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
return USBD_NORMAL_COMPLETION;
}
usbd_status

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbdi.h,v 1.105 2022/03/03 06:05:38 riastradh Exp $ */
/* $NetBSD: usbdi.h,v 1.106 2022/03/03 06:06:52 riastradh Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@ -95,7 +95,7 @@ usbd_status usbd_open_pipe_intr(struct usbd_interface *, uint8_t, uint8_t,
struct usbd_pipe **, void *, void *, uint32_t, usbd_callback, int);
usbd_status usbd_open_pipe(struct usbd_interface *, uint8_t, uint8_t,
struct usbd_pipe **);
usbd_status usbd_close_pipe(struct usbd_pipe *);
void usbd_close_pipe(struct usbd_pipe *);
usbd_status usbd_transfer(struct usbd_xfer *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbnet.c,v 1.92 2022/03/03 06:05:38 riastradh Exp $ */
/* $NetBSD: usbnet.c,v 1.93 2022/03/03 06:06:52 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.92 2022/03/03 06:05:38 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.93 2022/03/03 06:06:52 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -779,10 +779,7 @@ usbnet_ep_close_pipes(struct usbnet * const un)
for (size_t i = 0; i < __arraycount(unp->unp_ep); i++) {
if (unp->unp_ep[i] == NULL)
continue;
usbd_status err = usbd_close_pipe(unp->unp_ep[i]);
if (err)
aprint_error_dev(un->un_dev, "close pipe %zu: %s\n", i,
usbd_errstr(err));
usbd_close_pipe(unp->unp_ep[i]);
unp->unp_ep[i] = NULL;
}
}