Since usbd pipes contain a per-controller part, I'd like to malloc them
with M_ZERO to properly initialize the per-controller fields to 0.
ok?
Index: usb_subr.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.98
diff -u -p -r1.98 usb_subr.c
--- usb_subr.c 9 Feb 2014 13:21:48 -0000 1.98
+++ usb_subr.c 7 Mar 2014 13:58:34 -0000
@@ -793,25 +793,20 @@ usbd_setup_pipe(struct usbd_device *dev,
struct usbd_pipe *p;
usbd_status err;
- DPRINTFN(1,("usbd_setup_pipe: dev=%p iface=%p ep=%p pipe=%p\n",
+ DPRINTF(("%s: dev=%p iface=%p ep=%p pipe=%p\n", __func__,
dev, iface, ep, pipe));
- p = malloc(dev->bus->pipe_size, M_USB, M_NOWAIT);
+ p = malloc(dev->bus->pipe_size, M_USB, M_NOWAIT|M_ZERO);
if (p == NULL)
return (USBD_NOMEM);
p->device = dev;
p->iface = iface;
p->endpoint = ep;
ep->refcnt++;
- p->intrxfer = 0;
- p->running = 0;
- p->aborting = 0;
- p->repeat = 0;
p->interval = ival;
SIMPLEQ_INIT(&p->queue);
err = dev->bus->methods->open_pipe(p);
if (err) {
- DPRINTFN(-1,("usbd_setup_pipe: endpoint=0x%x failed, error="
- "%s\n",
+ DPRINTF(("%s: endpoint=0x%x failed, error=%s\n", __func__,
ep->edesc->bEndpointAddress, usbd_errstr(err)));
free(p, M_USB);
return (err);