summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authormiko <miko@cvs.openbsd.org>2018-09-07 03:54:13 +0000
committermiko <miko@cvs.openbsd.org>2018-09-07 03:54:13 +0000
commit56c380d84f98e81ada69de68dc54a156edf10cab (patch)
treea81b818c9c9dfbfbf5a26a71f44948a5f98d2203 /sys
parent30866d6485d3e781dc08c172b2dac7a28603db52 (diff)
move initial jack count to alloc_all_endpoints(), and reset count to zero
in free_all_jacks(). ok stsp@ ratchov@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/umidi.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c
index 1b5e60a72cb..45e50d70adf 100644
--- a/sys/dev/usb/umidi.c
+++ b/sys/dev/usb/umidi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umidi.c,v 1.47 2018/09/06 09:48:23 miko Exp $ */
+/* $OpenBSD: umidi.c,v 1.48 2018/09/07 03:54:12 miko Exp $ */
/* $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -387,6 +387,8 @@ alloc_all_endpoints(struct umidi_softc *sc)
struct umidi_endpoint *ep;
int i;
+ sc->sc_out_num_jacks = sc->sc_in_num_jacks = 0;
+
if (UMQ_ISTYPE(sc, UMQ_TYPE_FIXED_EP))
err = alloc_all_endpoints_fixed_ep(sc);
else if (UMQ_ISTYPE(sc, UMQ_TYPE_YAMAHA))
@@ -436,8 +438,6 @@ alloc_all_endpoints_fixed_ep(struct umidi_softc *sc)
fp = umidi_get_quirk_data_from_type(sc->sc_quirk,
UMQ_TYPE_FIXED_EP);
- sc->sc_out_num_jacks = 0;
- sc->sc_in_num_jacks = 0;
sc->sc_out_num_endpoints = fp->num_out_ep;
sc->sc_in_num_endpoints = fp->num_in_ep;
sc->sc_endpoints = mallocarray(sc->sc_out_num_endpoints +
@@ -521,7 +521,6 @@ alloc_all_endpoints_yamaha(struct umidi_softc *sc)
int out_addr, in_addr, in_packetsize, i, dir;
size_t remain, descsize;
- sc->sc_out_num_jacks = sc->sc_in_num_jacks = 0;
out_addr = in_addr = 0;
/* detect endpoints */
@@ -627,7 +626,6 @@ alloc_all_endpoints_genuine(struct umidi_softc *sc)
if (!p)
return USBD_NOMEM;
- sc->sc_out_num_jacks = sc->sc_in_num_jacks = 0;
sc->sc_out_num_endpoints = sc->sc_in_num_endpoints = 0;
epaddr = -1;
@@ -780,6 +778,7 @@ free_all_jacks(struct umidi_softc *sc)
if (sc->sc_out_jacks) {
free(sc->sc_jacks, M_USBDEV, jacks * sizeof(*sc->sc_out_jacks));
sc->sc_jacks = sc->sc_in_jacks = sc->sc_out_jacks = NULL;
+ sc->sc_out_num_jacks = sc->sc_in_num_jacks = 0;
}
splx(s);
}