From: mglocker Date: Fri, 9 Sep 2022 21:16:54 +0000 (+0000) Subject: Let pool_get(9) do the memory initialisation directly. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a0d2b8da8f7d29cc017423391e8b2e36a3fa6aa6;p=openbsd Let pool_get(9) do the memory initialisation directly. ok kettenis@ --- diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c index 8a10a96cfa5..a75bdf20360 100644 --- a/sys/dev/usb/dwc2/dwc2.c +++ b/sys/dev/usb/dwc2/dwc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2.c,v 1.65 2022/09/05 20:11:44 mglocker Exp $ */ +/* $OpenBSD: dwc2.c,v 1.66 2022/09/09 21:16:54 mglocker Exp $ */ /* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */ /*- @@ -230,9 +230,8 @@ dwc2_allocx(struct usbd_bus *bus) DPRINTFN(10, "\n"); DWC2_EVCNT_INCR(sc->sc_ev_xferpoolget); - dxfer = pool_get(&sc->sc_xferpool, PR_WAITOK); + dxfer = pool_get(&sc->sc_xferpool, PR_NOWAIT | PR_ZERO); if (dxfer != NULL) { - memset(dxfer, 0, sizeof(*dxfer)); dxfer->urb = dwc2_hcd_urb_alloc(sc->sc_hsotg, DWC2_MAXISOCPACKETS, M_NOWAIT); #ifdef DIAGNOSTIC @@ -1212,12 +1211,11 @@ dwc2_device_start(struct usbd_xfer *xfer) qh_allocated = true; } - qtd = pool_get(&sc->sc_qtdpool, PR_NOWAIT); + qtd = pool_get(&sc->sc_qtdpool, PR_NOWAIT | PR_ZERO); if (!qtd) { retval = -ENOMEM; goto fail1; } - memset(qtd, 0, sizeof(*qtd)); /* might need to check cpu_intr_p */ mtx_enter(&hsotg->lock); diff --git a/sys/dev/usb/dwc2/dwc2_hcd.c b/sys/dev/usb/dwc2/dwc2_hcd.c index 8d5a2e265e5..57bb209fcfb 100644 --- a/sys/dev/usb/dwc2/dwc2_hcd.c +++ b/sys/dev/usb/dwc2/dwc2_hcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2_hcd.c,v 1.27 2022/09/04 08:42:40 mglocker Exp $ */ +/* $OpenBSD: dwc2_hcd.c,v 1.28 2022/09/09 21:16:54 mglocker Exp $ */ /* $NetBSD: dwc2_hcd.c,v 1.15 2014/11/24 10:14:14 skrll Exp $ */ /* @@ -1945,8 +1945,6 @@ STATIC int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, if (!qtd) return -EINVAL; - memset(qtd, 0, sizeof(*qtd)); /* Required for OpenBSD */ - dwc2_hcd_qtd_init(qtd, urb); retval = dwc2_hcd_qtd_add(hsotg, qtd, qh); if (retval) { diff --git a/sys/dev/usb/dwc2/dwc2_hcdqueue.c b/sys/dev/usb/dwc2/dwc2_hcdqueue.c index 7a0013d0410..aa08330b1e9 100644 --- a/sys/dev/usb/dwc2/dwc2_hcdqueue.c +++ b/sys/dev/usb/dwc2/dwc2_hcdqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2_hcdqueue.c,v 1.14 2022/09/08 18:16:26 mglocker Exp $ */ +/* $OpenBSD: dwc2_hcdqueue.c,v 1.15 2022/09/09 21:16:54 mglocker Exp $ */ /* $NetBSD: dwc2_hcdqueue.c,v 1.11 2014/09/03 10:00:08 skrll Exp $ */ /* @@ -1657,7 +1657,7 @@ struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, return NULL; /* Allocate memory */ - qh = pool_get(&sc->sc_qhpool, PR_ZERO | PR_NOWAIT); + qh = pool_get(&sc->sc_qhpool, PR_NOWAIT | PR_ZERO); if (!qh) return NULL;