Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Code consistency. NFCI.



details:   https://anonhg.NetBSD.org/src/rev/b47f0a0d3fef
branches:  trunk
changeset: 1026787:b47f0a0d3fef
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Dec 07 07:54:32 2021 +0000

description:
Code consistency.  NFCI.

diffstat:

 sys/dev/usb/ehci.c |  47 +++++++++++++++++++++++------------------------
 1 files changed, 23 insertions(+), 24 deletions(-)

diffs (115 lines):

diff -r 111bd4d883ae -r b47f0a0d3fef sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Tue Dec 07 07:09:12 2021 +0000
+++ b/sys/dev/usb/ehci.c        Tue Dec 07 07:54:32 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.287 2021/12/05 11:05:37 riastradh Exp $ */
+/*     $NetBSD: ehci.c,v 1.288 2021/12/07 07:54:32 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.287 2021/12/05 11:05:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.288 2021/12/07 07:54:32 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2788,7 +2788,6 @@
 ehci_alloc_sqh(ehci_softc_t *sc)
 {
        ehci_soft_qh_t *sqh;
-       usbd_status err;
        int i, offs;
        usb_dma_t dma;
 
@@ -2799,14 +2798,14 @@
                DPRINTF("allocating chunk", 0, 0, 0, 0);
                mutex_exit(&sc->sc_lock);
 
-               err = usb_allocmem(&sc->sc_bus, EHCI_SQH_SIZE * EHCI_SQH_CHUNK,
+               int err = usb_allocmem(&sc->sc_bus,
+                   EHCI_SQH_SIZE * EHCI_SQH_CHUNK,
                    EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
-#ifdef EHCI_DEBUG
-               if (err)
-                       printf("ehci_alloc_sqh: usb_allocmem()=%d\n", err);
-#endif
-               if (err)
+
+               if (err) {
+                       DPRINTF("alloc returned %jd", err, 0, 0, 0);
                        return NULL;
+               }
 
                mutex_enter(&sc->sc_lock);
                for (i = 0; i < EHCI_SQH_CHUNK; i++) {
@@ -2852,15 +2851,13 @@
                mutex_exit(&sc->sc_lock);
 
                int err = usb_allocmem(&sc->sc_bus,
-                   EHCI_SQTD_SIZE*EHCI_SQTD_CHUNK,
-                   EHCI_PAGE_SIZE, USBMALLOC_COHERENT,
-                   &dma);
-#ifdef EHCI_DEBUG
-               if (err)
-                       printf("ehci_alloc_sqtd: usb_allocmem()=%d\n", err);
-#endif
-               if (err)
-                       goto done;
+                   EHCI_SQTD_SIZE * EHCI_SQTD_CHUNK,
+                   EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
+
+               if (err) {
+                       DPRINTF("alloc returned %jd", err, 0, 0, 0);
+                       return NULL;
+               }
 
                mutex_enter(&sc->sc_lock);
                for (i = 0; i < EHCI_SQTD_CHUNK; i++) {
@@ -2883,7 +2880,6 @@
        sqtd->nextqtd = NULL;
        sqtd->xfer = NULL;
 
-done:
        return sqtd;
 }
 
@@ -3109,15 +3105,17 @@
        if (freeitd == NULL) {
                DPRINTF("allocating chunk", 0, 0, 0, 0);
                mutex_exit(&sc->sc_lock);
-               int err = usb_allocmem(&sc->sc_bus, EHCI_ITD_SIZE * EHCI_ITD_CHUNK,
+
+               int err = usb_allocmem(&sc->sc_bus,
+                   EHCI_ITD_SIZE * EHCI_ITD_CHUNK,
                    EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
 
                if (err) {
                        DPRINTF("alloc returned %jd", err, 0, 0, 0);
                        return NULL;
                }
+
                mutex_enter(&sc->sc_lock);
-
                for (int i = 0; i < EHCI_ITD_CHUNK; i++) {
                        int offs = i * EHCI_ITD_SIZE;
                        itd = KERNADDR(&dma, offs);
@@ -3156,12 +3154,13 @@
        if (freesitd == NULL) {
                DPRINTF("allocating chunk", 0, 0, 0, 0);
                mutex_exit(&sc->sc_lock);
-               int err = usb_allocmem(&sc->sc_bus, EHCI_SITD_SIZE * EHCI_SITD_CHUNK,
+
+               int err = usb_allocmem(&sc->sc_bus,
+                   EHCI_SITD_SIZE * EHCI_SITD_CHUNK,
                    EHCI_PAGE_SIZE, USBMALLOC_COHERENT, &dma);
 
                if (err) {
-                       DPRINTF("alloc returned %jd", err, 0, 0,
-                           0);
+                       DPRINTF("alloc returned %jd", err, 0, 0, 0);
                        return NULL;
                }
 



Home | Main Index | Thread Index | Old Index