From a854e6884a9635329a1490f5cf8420c8ab6f8f85 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Mon, 17 Sep 2007 01:33:34 +0000 Subject: Only the most obvious bzero() -> M_ZERO changes. No cast changes, no MALLOC/FREE, etc. Just adding M_ZERO to malloc() and deleting an immediately adjacent bzero(). --- sys/arch/mac68k/dev/grf_iv.c | 5 ++--- sys/arch/mac68k/dev/grf_mv.c | 5 ++--- sys/arch/macppc/dev/awacs.c | 5 ++--- sys/arch/macppc/dev/dbdma.c | 5 ++--- sys/arch/macppc/dev/i2s.c | 5 ++--- sys/arch/sparc64/dev/central.c | 5 ++--- sys/arch/sparc64/dev/ebus_mainbus.c | 5 ++--- sys/arch/sparc64/dev/fhc.c | 5 ++--- sys/arch/sparc64/dev/sbus.c | 5 ++--- sys/arch/sparc64/dev/upa.c | 5 ++--- sys/arch/sparc64/sparc64/intr.c | 5 ++--- sys/arch/vax/if/if_qe.c | 5 ++--- sys/arch/zaurus/dev/zaurus_kbd.c | 8 +++----- 13 files changed, 27 insertions(+), 41 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/mac68k/dev/grf_iv.c b/sys/arch/mac68k/dev/grf_iv.c index 6ac8c2186db..08d12e94521 100644 --- a/sys/arch/mac68k/dev/grf_iv.c +++ b/sys/arch/mac68k/dev/grf_iv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf_iv.c,v 1.41 2006/03/13 22:35:17 miod Exp $ */ +/* $OpenBSD: grf_iv.c,v 1.42 2007/09/17 01:33:32 krw Exp $ */ /* $NetBSD: grf_iv.c,v 1.17 1997/02/20 00:23:27 scottr Exp $ */ /* @@ -175,8 +175,7 @@ macfb_obio_attach(struct device *parent, struct device *self, void *aux) sc->card_id = 0; sc->sc_tag = oa->oa_tag; - dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK); - bzero(dc, sizeof(*dc)); + dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK | M_ZERO); switch (current_mac_model->class) { case MACH_CLASSQ2: diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c index 1952836e6f3..19d3231ba3f 100644 --- a/sys/arch/mac68k/dev/grf_mv.c +++ b/sys/arch/mac68k/dev/grf_mv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf_mv.c,v 1.34 2007/09/10 20:29:46 miod Exp $ */ +/* $OpenBSD: grf_mv.c,v 1.35 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: grf_nubus.c,v 1.62 2001/01/22 20:27:02 briggs Exp $ */ /* @@ -195,8 +195,7 @@ macfb_nubus_attach(struct device *parent, struct device *self, void *aux) load_image_data((caddr_t)&image_store, &image); - dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK); - bzero(dc, sizeof(*dc)); + dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK | M_ZERO); dc->dc_vaddr = (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_handle); dc->dc_paddr = sc->sc_basepa; diff --git a/sys/arch/macppc/dev/awacs.c b/sys/arch/macppc/dev/awacs.c index c7eafabb261..380b4a79e9e 100644 --- a/sys/arch/macppc/dev/awacs.c +++ b/sys/arch/macppc/dev/awacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: awacs.c,v 1.19 2007/04/22 22:31:14 deraadt Exp $ */ +/* $OpenBSD: awacs.c,v 1.20 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: awacs.c,v 1.4 2001/02/26 21:07:51 wiz Exp $ */ /*- @@ -990,10 +990,9 @@ awacs_allocm(void *h, int dir, size_t size, int type, int flags) if (size > AWACS_DMALIST_MAX * AWACS_DMASEG_MAX) return (NULL); - p = malloc(sizeof(*p), type, flags); + p = malloc(sizeof(*p), type, flags | M_ZERO); if (!p) return (NULL); - bzero(p, sizeof(*p)); /* convert to the bus.h style, not used otherwise */ if (flags & M_NOWAIT) diff --git a/sys/arch/macppc/dev/dbdma.c b/sys/arch/macppc/dev/dbdma.c index d6622654072..904d4049a58 100644 --- a/sys/arch/macppc/dev/dbdma.c +++ b/sys/arch/macppc/dev/dbdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbdma.c,v 1.8 2006/01/13 19:25:44 miod Exp $ */ +/* $OpenBSD: dbdma.c,v 1.9 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: dbdma.c,v 1.2 1998/08/21 16:13:28 tsubai Exp $ */ /* @@ -119,10 +119,9 @@ dbdma_alloc(bus_dma_tag_t dmat, int size) dbdma_t dt; int error; - dt = malloc(sizeof *dt, M_DEVBUF, M_NOWAIT); + dt = malloc(sizeof *dt, M_DEVBUF, M_NOWAIT | M_ZERO); if (!dt) return (dt); - bzero(dt, sizeof *dt); dt->d_size = size *= sizeof(dbdma_command_t); dt->d_dmat = dmat; diff --git a/sys/arch/macppc/dev/i2s.c b/sys/arch/macppc/dev/i2s.c index a4942db7abd..c82529f87fe 100644 --- a/sys/arch/macppc/dev/i2s.c +++ b/sys/arch/macppc/dev/i2s.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i2s.c,v 1.8 2007/04/22 22:31:14 deraadt Exp $ */ +/* $OpenBSD: i2s.c,v 1.9 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: i2s.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */ /*- @@ -1188,10 +1188,9 @@ i2s_allocm(void *h, int dir, size_t size, int type, int flags) if (size > I2S_DMALIST_MAX * I2S_DMASEG_MAX) return (NULL); - p = malloc(sizeof(*p), type, flags); + p = malloc(sizeof(*p), type, flags | M_ZERO); if (!p) return (NULL); - bzero(p, sizeof(*p)); /* convert to the bus.h style, not used otherwise */ if (flags & M_NOWAIT) diff --git a/sys/arch/sparc64/dev/central.c b/sys/arch/sparc64/dev/central.c index 896d578b010..dda9441a651 100644 --- a/sys/arch/sparc64/dev/central.c +++ b/sys/arch/sparc64/dev/central.c @@ -1,4 +1,4 @@ -/* $OpenBSD: central.c,v 1.4 2004/09/27 17:28:03 jason Exp $ */ +/* $OpenBSD: central.c,v 1.5 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net) @@ -150,11 +150,10 @@ central_alloc_bus_tag(struct central_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT); + bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); if (bt == NULL) panic("central: couldn't alloc bus tag"); - bzero(bt, sizeof(*bt)); snprintf(bt->name, sizeof(bt->name), "%s", sc->sc_dv.dv_xname); bt->cookie = sc; bt->parent = sc->sc_bt; diff --git a/sys/arch/sparc64/dev/ebus_mainbus.c b/sys/arch/sparc64/dev/ebus_mainbus.c index 2e1f0260474..5e14adb4a98 100644 --- a/sys/arch/sparc64/dev/ebus_mainbus.c +++ b/sys/arch/sparc64/dev/ebus_mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ebus_mainbus.c,v 1.3 2007/04/07 20:15:54 kettenis Exp $ */ +/* $OpenBSD: ebus_mainbus.c,v 1.4 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2007 Mark Kettenis @@ -169,11 +169,10 @@ ebus_alloc_bus_tag(struct ebus_softc *sc, bus_space_tag_t parent) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT); + bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); if (bt == NULL) panic("could not allocate ebus bus tag"); - bzero(bt, sizeof *bt); snprintf(bt->name, sizeof(bt->name), "%s", sc->sc_dev.dv_xname); bt->cookie = sc; bt->parent = parent; diff --git a/sys/arch/sparc64/dev/fhc.c b/sys/arch/sparc64/dev/fhc.c index 064d3990818..75c9822ccbb 100644 --- a/sys/arch/sparc64/dev/fhc.c +++ b/sys/arch/sparc64/dev/fhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fhc.c,v 1.13 2007/05/01 19:44:56 kettenis Exp $ */ +/* $OpenBSD: fhc.c,v 1.14 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2004 Jason L. Wright (jason@thought.net) @@ -167,11 +167,10 @@ fhc_alloc_bus_tag(struct fhc_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT); + bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); if (bt == NULL) panic("fhc: couldn't alloc bus tag"); - bzero(bt, sizeof(*bt)); snprintf(bt->name, sizeof(bt->name), "%s", sc->sc_dv.dv_xname); bt->cookie = sc; bt->parent = sc->sc_bt; diff --git a/sys/arch/sparc64/dev/sbus.c b/sys/arch/sparc64/dev/sbus.c index 8a77debba3b..242fa0be227 100644 --- a/sys/arch/sparc64/dev/sbus.c +++ b/sys/arch/sparc64/dev/sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbus.c,v 1.27 2007/05/29 09:54:13 sobrado Exp $ */ +/* $OpenBSD: sbus.c,v 1.28 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp $ */ /*- @@ -772,11 +772,10 @@ sbus_alloc_bustag(struct sbus_softc *sc, int indirect) { struct sparc_bus_space_tag *sbt; - sbt = malloc(sizeof(*sbt), M_DEVBUF, M_NOWAIT); + sbt = malloc(sizeof(*sbt), M_DEVBUF, M_NOWAIT | M_ZERO); if (sbt == NULL) return (NULL); - bzero(sbt, sizeof *sbt); snprintf(sbt->name, sizeof(sbt->name), "%s", sc->sc_dev.dv_xname); sbt->cookie = sc; diff --git a/sys/arch/sparc64/dev/upa.c b/sys/arch/sparc64/dev/upa.c index 8b55ea4dfb4..323bdfaf68e 100644 --- a/sys/arch/sparc64/dev/upa.c +++ b/sys/arch/sparc64/dev/upa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: upa.c,v 1.5 2007/03/05 18:58:30 kettenis Exp $ */ +/* $OpenBSD: upa.c,v 1.6 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -163,11 +163,10 @@ upa_alloc_bus_tag(struct upa_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT); + bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); if (bt == NULL) panic("upa: couldn't alloc bus tag"); - bzero(bt, sizeof *bt); snprintf(bt->name, sizeof(bt->name), "%s", sc->sc_dev.dv_xname); bt->cookie = sc; diff --git a/sys/arch/sparc64/sparc64/intr.c b/sys/arch/sparc64/sparc64/intr.c index e9c424d1f2f..e488b25708e 100644 --- a/sys/arch/sparc64/sparc64/intr.c +++ b/sys/arch/sparc64/sparc64/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.27 2007/09/09 08:55:27 kettenis Exp $ */ +/* $OpenBSD: intr.c,v 1.28 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: intr.c,v 1.39 2001/07/19 23:38:11 eeh Exp $ */ /* @@ -308,8 +308,7 @@ softintr_establish(level, fun, arg) { struct intrhand *ih; - ih = malloc(sizeof(*ih), M_DEVBUF, 0); - bzero(ih, sizeof(*ih)); + ih = malloc(sizeof(*ih), M_DEVBUF, M_ZERO); ih->ih_fun = (int (*)(void *))fun; /* XXX */ ih->ih_arg = arg; ih->ih_pil = level; diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index dc9027a8c15..24dce6176a5 100644 --- a/sys/arch/vax/if/if_qe.c +++ b/sys/arch/vax/if/if_qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qe.c,v 1.20 2006/04/16 00:46:32 pascoe Exp $ */ +/* $OpenBSD: if_qe.c,v 1.21 2007/09/17 01:33:33 krw Exp $ */ /* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -143,9 +143,8 @@ qematch(struct device *parent, struct cfdata *cf, void *aux) struct qe_ring *rp; int error; - ring = malloc(PROBESIZE, M_TEMP, M_WAITOK); + ring = malloc(PROBESIZE, M_TEMP, M_WAITOK | M_ZERO); bzero(sc, sizeof(struct qe_softc)); - bzero(ring, PROBESIZE); sc->sc_iot = ua->ua_iot; sc->sc_ioh = ua->ua_ioh; sc->sc_dmat = ua->ua_dmat; diff --git a/sys/arch/zaurus/dev/zaurus_kbd.c b/sys/arch/zaurus/dev/zaurus_kbd.c index 594055ba5c1..689e764da0c 100644 --- a/sys/arch/zaurus/dev/zaurus_kbd.c +++ b/sys/arch/zaurus/dev/zaurus_kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_kbd.c,v 1.28 2005/12/21 20:36:03 deraadt Exp $ */ +/* $OpenBSD: zaurus_kbd.c,v 1.29 2007/09/17 01:33:33 krw Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -204,12 +204,10 @@ zkbd_attach(struct device *parent, struct device *self, void *aux) } /* XXX */ sc->sc_okeystate = malloc(sc->sc_nsense * sc->sc_nstrobe, - M_DEVBUF, M_NOWAIT); - bzero(sc->sc_okeystate, (sc->sc_nsense * sc->sc_nstrobe)); + M_DEVBUF, M_NOWAIT | M_ZERO); sc->sc_keystate = malloc(sc->sc_nsense * sc->sc_nstrobe, - M_DEVBUF, M_NOWAIT); - bzero(sc->sc_keystate, (sc->sc_nsense * sc->sc_nstrobe)); + M_DEVBUF, M_NOWAIT | M_ZERO); /* set all the strobe bits */ for (i = 0; i < sc->sc_nstrobe; i++) { -- cgit v1.2.3