summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2007-09-09 01:00:36 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2007-09-09 01:00:36 +0000
commit1651c8d3c87ffaf30a439076f7d1fa43964eff57 (patch)
treeb8e03037eca2725925c132699ad7ece3ab73b3d0 /sys
parentef21376f2d5bc87fa993d2eb3175fa12e24c1bee (diff)
more M_ZERO conversions; ok krw@.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pcmcia/cfxga.c13
-rw-r--r--sys/dev/usb/hid.c5
-rw-r--r--sys/dev/usb/uaudio.c5
-rw-r--r--sys/dev/usb/uhidev.c5
-rw-r--r--sys/dev/usb/usb_subr.c5
-rw-r--r--sys/dev/usb/usbf_subr.c23
6 files changed, 22 insertions, 34 deletions
diff --git a/sys/dev/pcmcia/cfxga.c b/sys/dev/pcmcia/cfxga.c
index 5cce96617fb..4fab88cad89 100644
--- a/sys/dev/pcmcia/cfxga.c
+++ b/sys/dev/pcmcia/cfxga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfxga.c,v 1.14 2006/11/29 19:11:17 miod Exp $ */
+/* $OpenBSD: cfxga.c,v 1.15 2007/09/09 01:00:35 fgsch Exp $ */
/*
* Copyright (c) 2005, 2006, Matthieu Herrb and Miodrag Vallat
@@ -223,13 +223,12 @@ cfxga_install_function(struct pcmcia_function *pf)
/* Create a simple cfe. */
cfe = (struct pcmcia_config_entry *)malloc(sizeof *cfe,
- M_DEVBUF, M_NOWAIT);
+ M_DEVBUF, M_NOWAIT|M_ZERO);
if (cfe == NULL) {
DPRINTF(("%s: cfe allocation failed\n", __func__));
return (ENOMEM);
}
- bzero(cfe, sizeof *cfe);
cfe->number = 42; /* have to put some value... */
cfe->flags = PCMCIA_CFE_IO16;
cfe->iftype = PCMCIA_IFTYPE_MEMORY;
@@ -441,10 +440,10 @@ cfxga_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
struct rasops_info *ri;
u_int mode, width, height, depth, scrsize;
- scr = malloc(sizeof *scr, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
+ scr = malloc(sizeof *scr, M_DEVBUF,
+ (cold ? M_NOWAIT : M_WAITOK) | M_ZERO);
if (scr == NULL)
return (ENOMEM);
- bzero(scr, sizeof *scr);
mode = type - sc->sc_wsd;
#ifdef DIAGNOSTIC
@@ -506,12 +505,12 @@ cfxga_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
* emulation mode.
*/
scrsize = ri->ri_rows * ri->ri_cols * sizeof(struct wsdisplay_charcell);
- scr->scr_mem = malloc(scrsize, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
+ scr->scr_mem = malloc(scrsize, M_DEVBUF,
+ (cold ? M_NOWAIT : M_WAITOK) | M_ZERO);
if (scr->scr_mem == NULL) {
free(scr, M_DEVBUF);
return (ENOMEM);
}
- bzero(scr->scr_mem, scrsize);
ri->ri_ops.copycols = cfxga_copycols;
ri->ri_ops.copyrows = cfxga_copyrows;
diff --git a/sys/dev/usb/hid.c b/sys/dev/usb/hid.c
index f26bf0289d5..89439266542 100644
--- a/sys/dev/usb/hid.c
+++ b/sys/dev/usb/hid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hid.c,v 1.18 2007/06/05 08:43:55 mbalmer Exp $ */
+/* $OpenBSD: hid.c,v 1.19 2007/09/09 01:00:35 fgsch Exp $ */
/* $NetBSD: hid.c,v 1.23 2002/07/11 21:14:25 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
@@ -95,10 +95,9 @@ hid_start_parse(void *d, int len, enum hid_kind kind)
{
struct hid_data *s;
- s = malloc(sizeof *s, M_TEMP, M_WAITOK);
+ s = malloc(sizeof *s, M_TEMP, M_WAITOK|M_ZERO);
if (s == NULL)
panic("hid_start_parse");
- memset(s, 0, sizeof *s);
s->start = s->p = d;
s->end = (char *)d + len;
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index df7645b5f77..dced36df11f 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uaudio.c,v 1.49 2007/09/08 17:34:54 ratchov Exp $ */
+/* $OpenBSD: uaudio.c,v 1.50 2007/09/09 01:00:35 fgsch Exp $ */
/* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */
/*
@@ -1827,12 +1827,11 @@ uaudio_identify_ac(struct uaudio_softc *sc, const usb_config_descriptor_t *cdesc
ibufend = ibuf + aclen;
dp = (const usb_descriptor_t *)ibuf;
ndps = 0;
- iot = malloc(sizeof(struct io_terminal) * 256, M_TEMP, M_NOWAIT);
+ iot = malloc(sizeof(struct io_terminal) * 256, M_TEMP, M_NOWAIT|M_ZERO);
if (iot == NULL) {
printf("%s: no memory\n", __func__);
return USBD_NOMEM;
}
- bzero(iot, sizeof(struct io_terminal) * 256);
for (;;) {
ibuf += dp->bLength;
if (ibuf >= ibufend)
diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c
index 60025f35655..b9c09ec7a53 100644
--- a/sys/dev/usb/uhidev.c
+++ b/sys/dev/usb/uhidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhidev.c,v 1.27 2007/06/14 10:11:16 mbalmer Exp $ */
+/* $OpenBSD: uhidev.c,v 1.28 2007/09/09 01:00:35 fgsch Exp $ */
/* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -259,12 +259,11 @@ uhidev_attach(struct device *parent, struct device *self, void *aux)
printf("%s: %d report ids\n", sc->sc_dev.dv_xname, nrepid);
nrepid++;
sc->sc_subdevs = malloc(nrepid * sizeof(struct device *),
- M_USBDEV, M_NOWAIT);
+ M_USBDEV, M_NOWAIT|M_ZERO);
if (sc->sc_subdevs == NULL) {
printf("%s: no memory\n", sc->sc_dev.dv_xname);
return;
}
- bzero(sc->sc_subdevs, nrepid * sizeof(struct device *));
sc->sc_nrepid = nrepid;
sc->sc_isize = 0;
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c
index 12918013a98..3414ce64534 100644
--- a/sys/dev/usb/usb_subr.c
+++ b/sys/dev/usb/usb_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb_subr.c,v 1.57 2007/07/21 16:28:50 deraadt Exp $ */
+/* $OpenBSD: usb_subr.c,v 1.58 2007/09/09 01:00:35 fgsch Exp $ */
/* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
@@ -887,12 +887,11 @@ usbd_probe_and_attach(struct device *parent, usbd_device_handle dev, int port,
uaa.ifaces = ifaces;
uaa.nifaces = nifaces;
len = (nifaces+1) * sizeof dv;
- dev->subdevs = malloc(len, M_USB, M_NOWAIT);
+ dev->subdevs = malloc(len, M_USB, M_NOWAIT|M_ZERO);
if (dev->subdevs == NULL) {
free(ifaces, M_USB);
return (USBD_NOMEM);
}
- bzero(dev->subdevs, len);
found = 0;
for (i = 0; i < nifaces; i++) {
diff --git a/sys/dev/usb/usbf_subr.c b/sys/dev/usb/usbf_subr.c
index 3fc93cf128f..e5bc5dd5768 100644
--- a/sys/dev/usb/usbf_subr.c
+++ b/sys/dev/usb/usbf_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbf_subr.c,v 1.10 2007/07/27 09:16:09 mbalmer Exp $ */
+/* $OpenBSD: usbf_subr.c,v 1.11 2007/09/09 01:00:35 fgsch Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -151,11 +151,10 @@ usbf_new_device(struct device *parent, usbf_bus_handle bus, int depth,
KASSERT(up->device == NULL);
#endif
- dev = malloc(sizeof(*dev), M_USB, M_NOWAIT);
+ dev = malloc(sizeof(*dev), M_USB, M_NOWAIT|M_ZERO);
if (dev == NULL)
return USBF_NOMEM;
- bzero(dev, sizeof *dev);
dev->bus = bus;
dev->string_id = USBF_STRING_ID_MIN;
SIMPLEQ_INIT(&dev->configs);
@@ -397,23 +396,21 @@ usbf_add_config(usbf_device_handle dev, usbf_config_handle *ucp)
struct usbf_config *uc;
usb_config_descriptor_t *cd;
- uc = malloc(sizeof *uc, M_USB, M_NOWAIT);
+ uc = malloc(sizeof *uc, M_USB, M_NOWAIT|M_ZERO);
if (uc == NULL)
return USBF_NOMEM;
- cd = malloc(sizeof *cd, M_USB, M_NOWAIT);
+ cd = malloc(sizeof *cd, M_USB, M_NOWAIT|M_ZERO);
if (cd == NULL) {
free(uc, M_USB);
return USBF_NOMEM;
}
- bzero(uc, sizeof *uc);
uc->uc_device = dev;
uc->uc_cdesc = cd;
uc->uc_cdesc_size = sizeof *cd;
SIMPLEQ_INIT(&uc->iface_head);
- bzero(cd, sizeof *cd);
cd->bLength = USB_CONFIG_DESCRIPTOR_SIZE;
cd->bDescriptorType = UDESC_CONFIG;
USETW(cd->wTotalLength, USB_CONFIG_DESCRIPTOR_SIZE);
@@ -475,23 +472,21 @@ usbf_add_interface(usbf_config_handle uc, u_int8_t bInterfaceClass,
if (uc->uc_closed)
return USBF_INVAL;
- ui = malloc(sizeof *ui, M_USB, M_NOWAIT);
+ ui = malloc(sizeof *ui, M_USB, M_NOWAIT|M_ZERO);
if (ui == NULL)
return USBF_NOMEM;
- id = malloc(sizeof *id, M_USB, M_NOWAIT);
+ id = malloc(sizeof *id, M_USB, M_NOWAIT|M_ZERO);
if (id == NULL) {
free(ui, M_USB);
return USBF_NOMEM;
}
- bzero(ui, sizeof *ui);
ui->config = uc;
ui->idesc = id;
LIST_INIT(&ui->pipes);
SIMPLEQ_INIT(&ui->endpoint_head);
- bzero(id, sizeof *id);
id->bLength = USB_INTERFACE_DESCRIPTOR_SIZE;
id->bDescriptorType = UDESC_INTERFACE;
id->bInterfaceNumber = uc->uc_cdesc->bNumInterface;
@@ -518,21 +513,19 @@ usbf_add_endpoint(usbf_interface_handle ui, u_int8_t bEndpointAddress,
if (ui->config->uc_closed)
return USBF_INVAL;
- ue = malloc(sizeof *ue, M_USB, M_NOWAIT);
+ ue = malloc(sizeof *ue, M_USB, M_NOWAIT|M_ZERO);
if (ue == NULL)
return USBF_NOMEM;
- ed = malloc(sizeof *ed, M_USB, M_NOWAIT);
+ ed = malloc(sizeof *ed, M_USB, M_NOWAIT|M_ZERO);
if (ed == NULL) {
free(ue, M_USB);
return USBF_NOMEM;
}
- bzero(ue, sizeof *ue);
ue->iface = ui;
ue->edesc = ed;
- bzero(ed, sizeof *ed);
ed->bLength = USB_ENDPOINT_DESCRIPTOR_SIZE;
ed->bDescriptorType = UDESC_ENDPOINT;
ed->bEndpointAddress = bEndpointAddress;