Call malloc(9) with M_ZERO flag instead of memset() after malloc().
This commit is contained in:
parent
e757f639d2
commit
448d063b57
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mly.c,v 1.8 2001/11/13 07:48:46 lukem Exp $ */
|
||||
/* $NetBSD: mly.c,v 1.9 2002/01/14 13:23:36 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.8 2001/11/13 07:48:46 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.9 2002/01/14 13:23:36 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -655,8 +655,7 @@ mly_scan_btl(struct mly_softc *mly, int bus, int target)
|
||||
|
||||
/* Set up the data buffer. */
|
||||
mc->mc_data = malloc(sizeof(union mly_devinfo),
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
memset(mc->mc_data, 0, sizeof(union mly_devinfo));
|
||||
M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
|
||||
mc->mc_flags |= MLY_CCB_DATAIN;
|
||||
mc->mc_complete = mly_complete_rescan;
|
||||
@ -1042,8 +1041,8 @@ mly_fetch_event(struct mly_softc *mly)
|
||||
return;
|
||||
|
||||
/* Set up the data buffer. */
|
||||
mc->mc_data = malloc(sizeof(struct mly_event), M_DEVBUF, M_NOWAIT);
|
||||
memset(mc->mc_data, 0, sizeof(struct mly_event));
|
||||
mc->mc_data = malloc(sizeof(struct mly_event), M_DEVBUF,
|
||||
M_NOWAIT|M_ZERO);
|
||||
|
||||
mc->mc_length = sizeof(struct mly_event);
|
||||
mc->mc_flags |= MLY_CCB_DATAIN;
|
||||
@ -1648,8 +1647,7 @@ mly_alloc_ccbs(struct mly_softc *mly)
|
||||
return (rv);
|
||||
|
||||
mly->mly_ccbs = malloc(sizeof(struct mly_ccb) * mly->mly_ncmds,
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
memset(mly->mly_ccbs, 0, sizeof(struct mly_ccb) * mly->mly_ncmds);
|
||||
M_DEVBUF, M_NOWAIT|M_ZERO);
|
||||
|
||||
for (i = 0; i < mly->mly_ncmds; i++) {
|
||||
mc = mly->mly_ccbs + i;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uhci.c,v 1.149 2001/11/21 15:48:37 augustss Exp $ */
|
||||
/* $NetBSD: uhci.c,v 1.150 2002/01/14 13:23:37 tsutsui Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
@ -49,7 +49,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.149 2001/11/21 15:48:37 augustss Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.150 2002/01/14 13:23:37 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -595,8 +595,8 @@ uhci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
|
||||
u_int32_t i;
|
||||
uhci_soft_td_t **stds;
|
||||
DPRINTF(("uhci_allocm: get %d TDs\n", n));
|
||||
stds = malloc(sizeof(uhci_soft_td_t *) * n, M_TEMP, M_NOWAIT);
|
||||
memset(stds, 0, sizeof(uhci_soft_td_t *) * n);
|
||||
stds = malloc(sizeof(uhci_soft_td_t *) * n, M_TEMP,
|
||||
M_NOWAIT|M_ZERO);
|
||||
for(i=0; i < n; i++)
|
||||
stds[i] = uhci_alloc_std(sc);
|
||||
for(i=0; i < n; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user