From: mglocker Date: Mon, 22 Nov 2021 10:17:14 +0000 (+0000) Subject: Align memory allocation for USB device drivers and USB HC drivers: X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8985a220ef1558e92857a7be860d5c965bda0a32;p=openbsd Align memory allocation for USB device drivers and USB HC drivers: * USB device drivers use M_USBDEV instead of M_DEVBUF. * USB HC drivers use M_USBHC instead of M_DEVBUF. In a vanilla setup, this enlarges the USB memory pool. ok anton@ --- diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index 87c359d0ea7..34d7df09195 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci.c,v 1.215 2021/10/26 16:29:49 deraadt Exp $ */ +/* $OpenBSD: ehci.c,v 1.216 2021/11/22 10:17:14 mglocker Exp $ */ /* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */ /* @@ -331,7 +331,7 @@ ehci_init(struct ehci_softc *sc) return (err); if (ehcixfer == NULL) { - ehcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT); + ehcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT); if (ehcixfer == NULL) { printf("%s: unable to allocate pool descriptor\n", sc->sc_bus.bdev.dv_xname); diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c index 3d0e835978b..fb0e72a1288 100644 --- a/sys/dev/usb/if_athn_usb.c +++ b/sys/dev/usb/if_athn_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_usb.c,v 1.62 2021/10/31 12:24:02 stsp Exp $ */ +/* $OpenBSD: if_athn_usb.c,v 1.63 2021/11/22 10:17:14 mglocker Exp $ */ /*- * Copyright (c) 2011 Damien Bergamini @@ -1178,7 +1178,7 @@ athn_usb_node_alloc(struct ieee80211com *ic) { struct athn_node *an; - an = malloc(sizeof(struct athn_node), M_DEVBUF, M_NOWAIT | M_ZERO); + an = malloc(sizeof(struct athn_node), M_USBDEV, M_NOWAIT | M_ZERO); return (struct ieee80211_node *)an; } diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c index bb220831ffc..dbe3a9cadde 100644 --- a/sys/dev/usb/if_otus.c +++ b/sys/dev/usb/if_otus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_otus.c,v 1.69 2021/02/25 02:48:20 dlg Exp $ */ +/* $OpenBSD: if_otus.c,v 1.70 2021/11/22 10:17:14 mglocker Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -884,7 +884,7 @@ otus_write_barrier(struct otus_softc *sc) struct ieee80211_node * otus_node_alloc(struct ieee80211com *ic) { - return malloc(sizeof (struct otus_node), M_DEVBUF, M_NOWAIT | M_ZERO); + return malloc(sizeof (struct otus_node), M_USBDEV, M_NOWAIT | M_ZERO); } int diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index f56262e7119..8d58b4170d4 100644 --- a/sys/dev/usb/if_run.c +++ b/sys/dev/usb/if_run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_run.c,v 1.134 2021/11/01 12:08:46 krw Exp $ */ +/* $OpenBSD: if_run.c,v 1.135 2021/11/22 10:17:14 mglocker Exp $ */ /*- * Copyright (c) 2008-2010 Damien Bergamini @@ -1664,7 +1664,7 @@ run_read_eeprom(struct run_softc *sc) struct ieee80211_node * run_node_alloc(struct ieee80211com *ic) { - return malloc(sizeof (struct run_node), M_DEVBUF, M_NOWAIT | M_ZERO); + return malloc(sizeof (struct run_node), M_USBDEV, M_NOWAIT | M_ZERO); } int diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c index 953ab382ce1..6412af86dfa 100644 --- a/sys/dev/usb/if_wi_usb.c +++ b/sys/dev/usb/if_wi_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_usb.c,v 1.74 2021/08/09 07:21:48 jmatthew Exp $ */ +/* $OpenBSD: if_wi_usb.c,v 1.75 2021/11/22 10:17:14 mglocker Exp $ */ /* * Copyright (c) 2003 Dale Rahn. All rights reserved. @@ -409,7 +409,7 @@ wi_usb_detach(struct device *self, int flags) while (sc->wi_usb_nummem) { sc->wi_usb_nummem--; - free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_DEVBUF, + free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_USBDEV, sc->wi_usb_txmemsize[sc->wi_usb_nummem]); sc->wi_usb_txmem[sc->wi_usb_nummem] = NULL; sc->wi_usb_txmemsize[sc->wi_usb_nummem] = 0; @@ -539,7 +539,7 @@ wi_cmd_usb(struct wi_softc *wsc, int cmd, int val0, int val1, int val2) /* free alloc_nicmem regions */ while (sc->wi_usb_nummem) { sc->wi_usb_nummem--; - free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_DEVBUF, + free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_USBDEV, sc->wi_usb_txmemsize[sc->wi_usb_nummem]); sc->wi_usb_txmem[sc->wi_usb_nummem] = NULL; sc->wi_usb_txmemsize[sc->wi_usb_nummem] = 0; @@ -921,7 +921,7 @@ wi_alloc_nicmem_usb(struct wi_softc *wsc, int len, int *id) return ENOMEM; } - sc->wi_usb_txmem[nmem] = malloc(len, M_DEVBUF, M_WAITOK | M_CANFAIL); + sc->wi_usb_txmem[nmem] = malloc(len, M_USBDEV, M_WAITOK | M_CANFAIL); if (sc->wi_usb_txmem[nmem] == NULL) { sc->wi_usb_nummem--; return ENOMEM; @@ -1748,7 +1748,7 @@ wi_usb_thread(void *arg) struct wi_usb_thread_info *wi_thread_info; int s; - wi_thread_info = malloc(sizeof(*wi_thread_info), M_DEVBUF, M_WAITOK); + wi_thread_info = malloc(sizeof(*wi_thread_info), M_USBDEV, M_WAITOK); /* * is there a remote possibility that the device could diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 8194f253887..f8d9d532825 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.125 2020/07/31 10:49:33 mglocker Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.126 2021/11/22 10:17:14 mglocker Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini @@ -633,7 +633,7 @@ zyd_free_rx_list(struct zyd_softc *sc) struct ieee80211_node * zyd_node_alloc(struct ieee80211com *ic) { - return malloc(sizeof (struct zyd_node), M_DEVBUF, M_NOWAIT | M_ZERO); + return malloc(sizeof (struct zyd_node), M_USBDEV, M_NOWAIT | M_ZERO); } int diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 450f37e4520..d5b50bea9ff 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ohci.c,v 1.162 2021/10/26 16:29:49 deraadt Exp $ */ +/* $OpenBSD: ohci.c,v 1.163 2021/11/22 10:17:14 mglocker Exp $ */ /* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ @@ -720,7 +720,7 @@ ohci_init(struct ohci_softc *sc) LIST_INIT(&sc->sc_hash_itds[i]); if (ohcixfer == NULL) { - ohcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT); + ohcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT); if (ohcixfer == NULL) { printf("%s: unable to allocate pool descriptor\n", sc->sc_bus.bdev.dv_xname); diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index 3b1270ed7ca..910071ac936 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uaudio.c,v 1.161 2021/05/18 10:02:00 ratchov Exp $ */ +/* $OpenBSD: uaudio.c,v 1.162 2021/11/22 10:17:14 mglocker Exp $ */ /* * Copyright (c) 2018 Alexandre Ratchov * @@ -719,7 +719,7 @@ uaudio_mkname(struct uaudio_softc *sc, char *templ, char *res) while (1) { if (n == NULL) { n = malloc(sizeof(struct uaudio_name), - M_DEVBUF, M_WAITOK); + M_USBDEV, M_WAITOK); n->templ = templ; n->unit = 0; n->next = sc->names; @@ -799,7 +799,7 @@ uaudio_ranges_add(struct uaudio_ranges *r, int min, int max, int res) /* XXX: use 'res' here */ r->nval += max - min + 1; - e = malloc(sizeof(struct uaudio_ranges_el), M_DEVBUF, M_WAITOK); + e = malloc(sizeof(struct uaudio_ranges_el), M_USBDEV, M_WAITOK); e->min = min; e->max = max; e->res = res; @@ -817,7 +817,7 @@ uaudio_ranges_clear(struct uaudio_ranges *r) while ((e = r->el) != NULL) { r->el = e->next; - free(e, M_DEVBUF, sizeof(struct uaudio_ranges_el)); + free(e, M_USBDEV, sizeof(struct uaudio_ranges_el)); } r->nval = 0; } @@ -975,7 +975,7 @@ uaudio_req_ranges(struct uaudio_softc *sc, if (sizeof(req_buf) >= req_size) req = req_buf; else - req = malloc(req_size, M_DEVBUF, M_WAITOK); + req = malloc(req_size, M_USBDEV, M_WAITOK); p.rptr = p.wptr = req; if (!uaudio_req(sc, UT_READ_CLASS_INTERFACE, @@ -1003,7 +1003,7 @@ uaudio_req_ranges(struct uaudio_softc *sc, } if (req != req_buf) - free(req, M_DEVBUF, req_size); + free(req, M_USBDEV, req_size); return 1; } @@ -1126,7 +1126,7 @@ uaudio_feature_addent(struct uaudio_softc *sc, return; } - m = malloc(sizeof(struct uaudio_mixent), M_DEVBUF, M_WAITOK); + m = malloc(sizeof(struct uaudio_mixent), M_USBDEV, M_WAITOK); m->chan = chan; m->fname = features[uac_type].name; m->type = features[uac_type].mix_type; @@ -1140,13 +1140,13 @@ uaudio_feature_addent(struct uaudio_softc *sc, &m->ranges)) { printf("%s: failed to get ranges for %s control\n", DEVNAME(sc), m->fname); - free(m, M_DEVBUF, sizeof(struct uaudio_mixent)); + free(m, M_USBDEV, sizeof(struct uaudio_mixent)); return; } if (m->ranges.el == NULL) { printf("%s: skipped %s control with empty range\n", DEVNAME(sc), m->fname); - free(m, M_DEVBUF, sizeof(struct uaudio_mixent)); + free(m, M_USBDEV, sizeof(struct uaudio_mixent)); return; } #ifdef UAUDIO_DEBUG @@ -1166,7 +1166,7 @@ uaudio_feature_addent(struct uaudio_softc *sc, if (cmp == 0) { DPRINTF("%02u: %s.%s: duplicate feature for chan %d\n", u->id, u->name, m->fname, m->chan); - free(m, M_DEVBUF, sizeof(struct uaudio_mixent)); + free(m, M_USBDEV, sizeof(struct uaudio_mixent)); return; } if (cmp > 0) @@ -1290,7 +1290,7 @@ uaudio_process_unit(struct uaudio_softc *sc, */ u = uaudio_unit_byid(sc, id); if (u == NULL) { - u = malloc(sizeof(struct uaudio_unit), M_DEVBUF, M_WAITOK); + u = malloc(sizeof(struct uaudio_unit), M_USBDEV, M_WAITOK); u->id = id; u->type = subtype; u->term = 0; @@ -2556,7 +2556,7 @@ uaudio_process_as(struct uaudio_softc *sc, unsigned int type, subtype; int ispcm = 0; - a = malloc(sizeof(struct uaudio_alt), M_DEVBUF, M_WAITOK); + a = malloc(sizeof(struct uaudio_alt), M_USBDEV, M_WAITOK); a->mode = 0; a->nch = 0; a->v1_rates = 0; @@ -2592,7 +2592,7 @@ uaudio_process_as(struct uaudio_softc *sc, } if (!ispcm) { DPRINTF("%s: non-pcm iface\n", __func__); - free(a, M_DEVBUF, sizeof(struct uaudio_alt)); + free(a, M_USBDEV, sizeof(struct uaudio_alt)); return 1; } } @@ -2616,7 +2616,7 @@ uaudio_process_as(struct uaudio_softc *sc, if (a->mode == 0) { printf("%s: no data endpoints found\n", DEVNAME(sc)); - free(a, M_DEVBUF, sizeof(struct uaudio_alt)); + free(a, M_USBDEV, sizeof(struct uaudio_alt)); return 1; } @@ -2644,7 +2644,7 @@ uaudio_process_as(struct uaudio_softc *sc, *pa = a; return 1; failed: - free(a, M_DEVBUF, sizeof(struct uaudio_alt)); + free(a, M_USBDEV, sizeof(struct uaudio_alt)); return 0; } @@ -2683,7 +2683,7 @@ uaudio_fixup_params(struct uaudio_softc *sc) break; } p = malloc(sizeof(struct uaudio_params), - M_DEVBUF, M_WAITOK); + M_USBDEV, M_WAITOK); p->palt = ap; p->ralt = ar; p->v1_rates = rates; @@ -2700,7 +2700,7 @@ uaudio_fixup_params(struct uaudio_softc *sc) if (sc->params_list == NULL) { for (a = sc->alts; a != NULL; a = a->next) { p = malloc(sizeof(struct uaudio_params), - M_DEVBUF, M_WAITOK); + M_USBDEV, M_WAITOK); if (a->mode == AUMODE_PLAY) { p->palt = a; p->ralt = NULL; @@ -2791,7 +2791,7 @@ uaudio_xfer_alloc(struct uaudio_softc *sc, struct uaudio_xfer *xfer, return ENOMEM; xfer->sizes = mallocarray(count, - sizeof(xfer->sizes[0]), M_DEVBUF, M_WAITOK); + sizeof(xfer->sizes[0]), M_USBDEV, M_WAITOK); if (xfer->sizes == NULL) return ENOMEM; @@ -2811,7 +2811,7 @@ uaudio_xfer_free(struct uaudio_softc *sc, struct uaudio_xfer *xfer, xfer->usb_xfer = NULL; } if (xfer->sizes != NULL) { - free(xfer->sizes, M_DEVBUF, + free(xfer->sizes, M_USBDEV, sizeof(xfer->sizes[0]) * count); xfer->sizes = NULL; } @@ -3861,12 +3861,12 @@ uaudio_detach(struct device *self, int flags) while ((alt = sc->alts) != NULL) { sc->alts = alt->next; - free(alt, M_DEVBUF, sizeof(struct uaudio_alt)); + free(alt, M_USBDEV, sizeof(struct uaudio_alt)); } while ((params = sc->params_list) != NULL) { sc->params_list = params->next; - free(params, M_DEVBUF, sizeof(struct uaudio_params)); + free(params, M_USBDEV, sizeof(struct uaudio_params)); } while ((unit = sc->unit_list) != NULL) { @@ -3874,15 +3874,15 @@ uaudio_detach(struct device *self, int flags) while ((mixent = unit->mixent_list) != NULL) { unit->mixent_list = mixent->next; uaudio_ranges_clear(&mixent->ranges); - free(mixent, M_DEVBUF, sizeof(struct uaudio_mixent)); + free(mixent, M_USBDEV, sizeof(struct uaudio_mixent)); } uaudio_ranges_clear(&unit->rates); - free(unit, M_DEVBUF, sizeof(struct uaudio_unit)); + free(unit, M_USBDEV, sizeof(struct uaudio_unit)); } while ((name = sc->names)) { sc->names = name->next; - free(name, M_DEVBUF, sizeof(struct uaudio_name)); + free(name, M_USBDEV, sizeof(struct uaudio_name)); } return rv; diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c index dc1153b54c0..735af435162 100644 --- a/sys/dev/usb/udl.c +++ b/sys/dev/usb/udl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udl.c,v 1.95 2021/10/27 09:09:55 jasper Exp $ */ +/* $OpenBSD: udl.c,v 1.96 2021/11/22 10:17:14 mglocker Exp $ */ /* * Copyright (c) 2009 Marcus Glocker @@ -640,7 +640,7 @@ udl_alloc_screen(void *v, const struct wsscreen_descr *type, /* allocate character backing store */ sc->sc_cbs = mallocarray(sc->sc_ri.ri_rows, sc->sc_ri.ri_cols * - sizeof(*sc->sc_cbs), M_DEVBUF, M_NOWAIT|M_ZERO); + sizeof(*sc->sc_cbs), M_USBDEV, M_NOWAIT|M_ZERO); if (sc->sc_cbs == NULL) { printf("%s: can't allocate mem for character backing store!\n", DN(sc)); @@ -669,7 +669,7 @@ udl_free_screen(void *v, void *cookie) /* free character backing store */ if (sc->sc_cbs != NULL) - free(sc->sc_cbs, M_DEVBUF, sc->sc_cbslen); + free(sc->sc_cbs, M_USBDEV, sc->sc_cbslen); sc->sc_nscreens--; } @@ -1418,7 +1418,7 @@ void udl_free_huffman(struct udl_softc *sc) { if (sc->sc_huffman != NULL) { - free(sc->sc_huffman, M_DEVBUF, sc->sc_huffman_size); + free(sc->sc_huffman, M_USBDEV, sc->sc_huffman_size); sc->sc_huffman = NULL; sc->sc_huffman_size = 0; DPRINTF(1, "%s: huffman table freed\n", DN(sc)); @@ -1434,7 +1434,7 @@ udl_fbmem_alloc(struct udl_softc *sc) size = round_page(size); if (sc->sc_fbmem == NULL) { - sc->sc_fbmem = malloc(size, M_DEVBUF, M_NOWAIT|M_ZERO); + sc->sc_fbmem = malloc(size, M_USBDEV, M_NOWAIT|M_ZERO); if (sc->sc_fbmem == NULL) return (-1); } @@ -1446,7 +1446,7 @@ void udl_fbmem_free(struct udl_softc *sc) { if (sc->sc_fbmem != NULL) { - free(sc->sc_fbmem, M_DEVBUF, sc->sc_fbmemsize); + free(sc->sc_fbmem, M_USBDEV, sc->sc_fbmemsize); sc->sc_fbmem = NULL; sc->sc_fbmemsize = 0; } @@ -1500,7 +1500,7 @@ udl_cmd_alloc_buf(struct udl_softc *sc) { struct udl_cmd_buf *cb = &sc->sc_cmd_buf; - cb->buf = malloc(UDL_CMD_MAX_XFER_SIZE, M_DEVBUF, M_NOWAIT|M_ZERO); + cb->buf = malloc(UDL_CMD_MAX_XFER_SIZE, M_USBDEV, M_NOWAIT|M_ZERO); if (cb->buf == NULL) { printf("%s: %s: can't allocate buffer!\n", DN(sc), FUNC); @@ -1518,7 +1518,7 @@ udl_cmd_free_buf(struct udl_softc *sc) struct udl_cmd_buf *cb = &sc->sc_cmd_buf; if (cb->buf != NULL) { - free(cb->buf, M_DEVBUF, UDL_CMD_MAX_XFER_SIZE); + free(cb->buf, M_USBDEV, UDL_CMD_MAX_XFER_SIZE); cb->buf = NULL; } cb->off = 0; diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index df08caf2d8d..a2831d9d497 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhci.c,v 1.153 2021/10/26 16:29:49 deraadt Exp $ */ +/* $OpenBSD: uhci.c,v 1.154 2021/11/22 10:17:14 mglocker Exp $ */ /* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -363,7 +363,7 @@ uhci_init(struct uhci_softc *sc) uhci_reset(sc); if (uhcixfer == NULL) { - uhcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT); + uhcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT); if (uhcixfer == NULL) { printf("%s: unable to allocate pool descriptor\n", sc->sc_bus.bdev.dv_xname); diff --git a/sys/dev/usb/umass_scsi.c b/sys/dev/usb/umass_scsi.c index b3157c41eec..68956780229 100644 --- a/sys/dev/usb/umass_scsi.c +++ b/sys/dev/usb/umass_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass_scsi.c,v 1.61 2020/09/22 19:32:53 krw Exp $ */ +/* $OpenBSD: umass_scsi.c,v 1.62 2021/11/22 10:17:14 mglocker Exp $ */ /* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -84,7 +84,7 @@ umass_scsi_attach(struct umass_softc *sc) struct umass_scsi_softc *scbus; u_int16_t flags = 0; - scbus = malloc(sizeof(*scbus), M_DEVBUF, M_WAITOK | M_ZERO); + scbus = malloc(sizeof(*scbus), M_USBDEV, M_WAITOK | M_ZERO); sc->bus = scbus; @@ -136,7 +136,7 @@ umass_scsi_detach(struct umass_softc *sc, int flags) if (scbus != NULL) { if (scbus->sc_child != NULL) rv = config_detach(scbus->sc_child, flags); - free(scbus, M_DEVBUF, sizeof(*scbus)); + free(scbus, M_USBDEV, sizeof(*scbus)); sc->bus = NULL; } diff --git a/sys/dev/usb/utvfu.c b/sys/dev/usb/utvfu.c index 075372fe4ca..75c591f8b52 100644 --- a/sys/dev/usb/utvfu.c +++ b/sys/dev/usb/utvfu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utvfu.c,v 1.11 2020/07/31 10:49:33 mglocker Exp $ */ +/* $OpenBSD: utvfu.c,v 1.12 2021/11/22 10:17:14 mglocker Exp $ */ /* * Copyright (c) 2013 Lubomir Rintel * Copyright (c) 2013 Federico Simoncelli @@ -1507,7 +1507,7 @@ utvfu_vs_alloc_frame(struct utvfu_softc *sc) struct utvfu_frame_buf *fb = &sc->sc_fb; fb->size = sc->sc_max_frame_sz; - fb->buf = malloc(fb->size, M_DEVBUF, M_NOWAIT); + fb->buf = malloc(fb->size, M_USBDEV, M_NOWAIT); if (fb->buf == NULL) { printf("%s: can't allocate frame buffer!\n", DEVNAME(sc)); return (ENOMEM); @@ -1529,12 +1529,12 @@ utvfu_vs_free_frame(struct utvfu_softc *sc) struct utvfu_frame_buf *fb = &sc->sc_fb; if (fb->buf != NULL) { - free(fb->buf, M_DEVBUF, fb->size); + free(fb->buf, M_USBDEV, fb->size); fb->buf = NULL; } if (sc->sc_mmap_buffer != NULL) { - free(sc->sc_mmap_buffer, M_DEVBUF, sc->sc_mmap_bufsz); + free(sc->sc_mmap_buffer, M_USBDEV, sc->sc_mmap_bufsz); sc->sc_mmap_buffer = NULL; memset(sc->sc_mmap, 0, sizeof(sc->sc_mmap)); } @@ -1659,7 +1659,7 @@ utvfu_reqbufs(void *v, struct v4l2_requestbuffers *rb) return (ENOMEM); sc->sc_mmap_bufsz *= sc->sc_mmap_count; sc->sc_mmap_bufsz = round_page(sc->sc_mmap_bufsz); /* page align */ - sc->sc_mmap_buffer = malloc(sc->sc_mmap_bufsz, M_DEVBUF, M_NOWAIT); + sc->sc_mmap_buffer = malloc(sc->sc_mmap_bufsz, M_USBDEV, M_NOWAIT); if (sc->sc_mmap_buffer == NULL) { printf("%s: can't allocate mmap buffer!\n", DEVNAME(sc)); return (ENOMEM); diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index 1b3788de1d2..1c33f72cca1 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.213 2021/05/31 21:06:48 mglocker Exp $ */ +/* $OpenBSD: uvideo.c,v 1.214 2021/11/22 10:17:14 mglocker Exp $ */ /* * Copyright (c) 2008 Robert Nagy @@ -1773,7 +1773,7 @@ uvideo_vs_alloc_frame(struct uvideo_softc *sc) return (USBD_NOMEM); } - fb->buf = malloc(fb->buf_size, M_DEVBUF, M_NOWAIT); + fb->buf = malloc(fb->buf_size, M_USBDEV, M_NOWAIT); if (fb->buf == NULL) { printf("%s: can't allocate frame buffer!\n", DEVNAME(sc)); return (USBD_NOMEM); @@ -1797,12 +1797,12 @@ uvideo_vs_free_frame(struct uvideo_softc *sc) struct uvideo_frame_buffer *fb = &sc->sc_frame_buffer; if (fb->buf != NULL) { - free(fb->buf, M_DEVBUF, fb->buf_size); + free(fb->buf, M_USBDEV, fb->buf_size); fb->buf = NULL; } if (sc->sc_mmap_buffer != NULL) { - free(sc->sc_mmap_buffer, M_DEVBUF, sc->sc_mmap_buffer_size); + free(sc->sc_mmap_buffer, M_USBDEV, sc->sc_mmap_buffer_size); sc->sc_mmap_buffer = NULL; sc->sc_mmap_buffer_size = 0; } @@ -3309,7 +3309,7 @@ uvideo_reqbufs(void *v, struct v4l2_requestbuffers *rb) } buf_size_total = sc->sc_mmap_count * buf_size; buf_size_total = round_page(buf_size_total); /* page align buffer */ - sc->sc_mmap_buffer = malloc(buf_size_total, M_DEVBUF, M_NOWAIT); + sc->sc_mmap_buffer = malloc(buf_size_total, M_USBDEV, M_NOWAIT); if (sc->sc_mmap_buffer == NULL) { printf("%s: can't allocate mmap buffer!\n", DEVNAME(sc)); sc->sc_mmap_count = 0; diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index 675656c51e4..bf52be001bc 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xhci.c,v 1.122 2021/10/26 16:29:49 deraadt Exp $ */ +/* $OpenBSD: xhci.c,v 1.123 2021/11/22 10:17:14 mglocker Exp $ */ /* * Copyright (c) 2014-2015 Martin Pieuchot @@ -317,7 +317,7 @@ xhci_init(struct xhci_softc *sc) return (error); if (xhcixfer == NULL) { - xhcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT); + xhcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT); if (xhcixfer == NULL) { printf("%s: unable to allocate pool descriptor\n", DEVNAME(sc));