Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb usb: usbd_close_pipe never fails. Make it retur...
details: https://anonhg.NetBSD.org/src/rev/744bbe49e334
branches: trunk
changeset: 362561:744bbe49e334
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Mar 03 06:06:52 2022 +0000
description:
usb: usbd_close_pipe never fails. Make it return void.
Prune dead branches as a result of this change.
diffstat:
sys/dev/usb/if_atu.c | 17 ++++-------------
sys/dev/usb/if_urtw.c | 17 +++++------------
sys/dev/usb/ualea.c | 6 +++---
sys/dev/usb/usbdi.c | 8 +++-----
sys/dev/usb/usbdi.h | 4 ++--
sys/dev/usb/usbnet.c | 9 +++------
6 files changed, 20 insertions(+), 41 deletions(-)
diffs (206 lines):
diff -r 3e74999496b9 -r 744bbe49e334 sys/dev/usb/if_atu.c
--- a/sys/dev/usb/if_atu.c Thu Mar 03 06:05:38 2022 +0000
+++ b/sys/dev/usb/if_atu.c Thu Mar 03 06:06:52 2022 +0000
@@ -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 @@
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 @@
/* 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;
}
diff -r 3e74999496b9 -r 744bbe49e334 sys/dev/usb/if_urtw.c
--- a/sys/dev/usb/if_urtw.c Thu Mar 03 06:05:38 2022 +0000
+++ b/sys/dev/usb/if_urtw.c Thu Mar 03 06:06:52 2022 +0000
@@ -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 @@
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;
}
diff -r 3e74999496b9 -r 744bbe49e334 sys/dev/usb/ualea.c
--- a/sys/dev/usb/ualea.c Thu Mar 03 06:05:38 2022 +0000
+++ b/sys/dev/usb/ualea.c Thu Mar 03 06:06:52 2022 +0000
@@ -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 @@
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;
diff -r 3e74999496b9 -r 744bbe49e334 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Thu Mar 03 06:05:38 2022 +0000
+++ b/sys/dev/usb/usbdi.c Thu Mar 03 06:06:52 2022 +0000
@@ -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 @@
return err;
}
-usbd_status
+void
usbd_close_pipe(struct usbd_pipe *pipe)
{
USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
@@ -348,8 +348,6 @@
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
diff -r 3e74999496b9 -r 744bbe49e334 sys/dev/usb/usbdi.h
--- a/sys/dev/usb/usbdi.h Thu Mar 03 06:05:38 2022 +0000
+++ b/sys/dev/usb/usbdi.h Thu Mar 03 06:06:52 2022 +0000
@@ -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 @@
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 *);
diff -r 3e74999496b9 -r 744bbe49e334 sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c Thu Mar 03 06:05:38 2022 +0000
+++ b/sys/dev/usb/usbnet.c Thu Mar 03 06:06:52 2022 +0000
@@ -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 @@
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;
}
}
Home |
Main Index |
Thread Index |
Old Index