Module Name:    src
Committed By:   skrll
Date:           Tue Dec  7 07:54:32 UTC 2021

Modified Files:
        src/sys/dev/usb: ehci.c

Log Message:
Code consistency.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 src/sys/dev/usb/ehci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.287 src/sys/dev/usb/ehci.c:1.288
--- src/sys/dev/usb/ehci.c:1.287	Sun Dec  5 11:05:37 2021
+++ src/sys/dev/usb/ehci.c	Tue Dec  7 07:54:32 2021
@@ -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 @@ Static ehci_soft_qh_t *
 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 @@ ehci_alloc_sqh(ehci_softc_t *sc)
 		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 @@ ehci_alloc_sqtd(ehci_softc_t *sc)
 		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 @@ ehci_alloc_sqtd(ehci_softc_t *sc)
 	sqtd->nextqtd = NULL;
 	sqtd->xfer = NULL;
 
-done:
 	return sqtd;
 }
 
@@ -3109,15 +3105,17 @@ ehci_alloc_itd(ehci_softc_t *sc)
 	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);
 
+		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 @@ ehci_alloc_sitd(ehci_softc_t *sc)
 	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;
 		}
 

Reply via email to