summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-10-01 16:11:20 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-10-01 16:11:20 +0000
commit1d3a2c7615ad6b5663e200fe3e8a475ef3203245 (patch)
treede1c38fdba408d50ca09e62ce6c6e40d21d28491 /sys
parenta730dedabc875f93e81898068b1cccdb9e45cb7c (diff)
More easy bzero() -> M_ZERO. Use 'p = malloc(sizeof(*p) ...' where
obvious.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hppa/gsc/gsckbc.c5
-rw-r--r--sys/arch/sparc/dev/esp.c5
-rw-r--r--sys/arch/sparc/dev/fd.c5
-rw-r--r--sys/arch/sparc/dev/xd.c7
-rw-r--r--sys/arch/sparc/dev/xy.c7
-rw-r--r--sys/arch/sparc64/dev/ebus.c6
-rw-r--r--sys/arch/sparc64/dev/fd.c5
-rw-r--r--sys/arch/sparc64/dev/pckbc_ebus.c5
-rw-r--r--sys/arch/vax/vsa/lcg.c5
-rw-r--r--sys/arch/vax/vsa/lcspx.c5
-rw-r--r--sys/arch/vax/vsa/smg.c5
11 files changed, 24 insertions, 36 deletions
diff --git a/sys/arch/hppa/gsc/gsckbc.c b/sys/arch/hppa/gsc/gsckbc.c
index d2817304bc9..0f52af3ccfa 100644
--- a/sys/arch/hppa/gsc/gsckbc.c
+++ b/sys/arch/hppa/gsc/gsckbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gsckbc.c,v 1.9 2006/12/17 21:27:20 miod Exp $ */
+/* $OpenBSD: gsckbc.c,v 1.10 2007/10/01 16:11:19 krw Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -392,8 +392,7 @@ gsckbc_attach(struct device *parent, struct device *self, void *aux)
sc->intr_establish = gsckbc_intr_establish;
- t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
- bzero(t, sizeof(struct pckbc_internal));
+ t = malloc(sizeof(*t), M_DEVBUF, M_WAITOK | M_ZERO);
t->t_iot = iot;
/* XXX it does not make sense to only map two ports here */
t->t_ioh_d = t->t_ioh_c = ioh;
diff --git a/sys/arch/sparc/dev/esp.c b/sys/arch/sparc/dev/esp.c
index cb6f92e13bf..bb46760890a 100644
--- a/sys/arch/sparc/dev/esp.c
+++ b/sys/arch/sparc/dev/esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esp.c,v 1.24 2006/06/02 20:00:54 miod Exp $ */
+/* $OpenBSD: esp.c,v 1.25 2007/10/01 16:11:19 krw Exp $ */
/* $NetBSD: esp.c,v 1.69 1997/08/27 11:24:18 bouyer Exp $ */
/*
@@ -282,12 +282,11 @@ espattach(parent, self, aux)
* Allocate a softc for the DMA companion, which will not
* get a regular attachment.
*/
- dsc = malloc(sizeof(struct dma_softc), M_DEVBUF, M_NOWAIT);
+ dsc = malloc(sizeof(*dsc), M_DEVBUF, M_NOWAIT | M_ZERO);
if (dsc == NULL) {
printf(": could not allocate dma softc\n");
return;
}
- bzero(dsc, sizeof(struct dma_softc));
strlcpy(dsc->sc_dev.dv_xname, sc->sc_dev.dv_xname,
sizeof(dsc->sc_dev.dv_xname));
esc->sc_dma = dsc;
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index a25708f3bfb..d0751be1fd8 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.54 2007/06/20 18:15:47 deraadt Exp $ */
+/* $OpenBSD: fd.c,v 1.55 2007/10/01 16:11:19 krw Exp $ */
/* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */
/*-
@@ -1889,11 +1889,10 @@ fdformat(dev, finfo, p)
struct buf *bp;
/* set up a buffer header for fdstrategy() */
- bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT);
+ bp = malloc(sizeof(*bp), M_TEMP, M_NOWAIT | M_ZERO);
if (bp == 0)
return (ENOBUFS);
- bzero((void *)bp, sizeof(struct buf));
bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
bp->b_proc = p;
bp->b_dev = dev;
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index 1010d16b291..b33335693b3 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xd.c,v 1.41 2007/07/01 19:06:57 miod Exp $ */
+/* $OpenBSD: xd.c,v 1.42 2007/10/01 16:11:19 krw Exp $ */
/* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */
/*
@@ -427,11 +427,10 @@ xdcattach(parent, self, aux)
/* Setup device view of DVMA address */
xdc->dvmaiopb = (struct xd_iopb *) ((u_long) xdc->iopbase - DVMA_BASE);
- xdc->reqs = (struct xd_iorq *)
- malloc(XDC_MAXIOPB * sizeof(struct xd_iorq), M_DEVBUF, M_NOWAIT);
+ xdc->reqs = malloc(XDC_MAXIOPB * sizeof(struct xd_iorq), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
if (xdc->reqs == NULL)
panic("xdc malloc");
- bzero(xdc->reqs, XDC_MAXIOPB * sizeof(struct xd_iorq));
/* init free list, iorq to iopb pointers, and non-zero fields in the
* iopb which never change. */
diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c
index 00954f8d38a..973af681da0 100644
--- a/sys/arch/sparc/dev/xy.c
+++ b/sys/arch/sparc/dev/xy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xy.c,v 1.38 2007/07/01 19:06:57 miod Exp $ */
+/* $OpenBSD: xy.c,v 1.39 2007/10/01 16:11:19 krw Exp $ */
/* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */
/*
@@ -378,11 +378,10 @@ xycattach(parent, self, aux)
xyc->iopbase = tmp;
xyc->iopbase = dtmp; /* XXX TMP HACK */
xyc->dvmaiopb = (struct xy_iopb *) ((u_long)dtmp - DVMA_BASE);
- xyc->reqs = (struct xy_iorq *)
- malloc(XYC_MAXIOPB * sizeof(struct xy_iorq), M_DEVBUF, M_NOWAIT);
+ xyc->reqs = malloc(XYC_MAXIOPB * sizeof(struct xy_iorq), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
if (xyc->reqs == NULL)
panic("xyc malloc");
- bzero(xyc->reqs, XYC_MAXIOPB * sizeof(struct xy_iorq));
/*
* init iorq to iopb pointers, and non-zero fields in the
diff --git a/sys/arch/sparc64/dev/ebus.c b/sys/arch/sparc64/dev/ebus.c
index 8ffae5cb851..3fb1068e57e 100644
--- a/sys/arch/sparc64/dev/ebus.c
+++ b/sys/arch/sparc64/dev/ebus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ebus.c,v 1.18 2007/09/18 00:46:41 krw Exp $ */
+/* $OpenBSD: ebus.c,v 1.19 2007/10/01 16:11:19 krw Exp $ */
/* $NetBSD: ebus.c,v 1.24 2001/07/25 03:49:54 eeh Exp $ */
/*
@@ -395,12 +395,10 @@ ebus_alloc_dma_tag(struct ebus_softc *sc, bus_dma_tag_t pdt)
{
bus_dma_tag_t dt;
- dt = (bus_dma_tag_t)
- malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_NOWAIT);
+ dt = malloc(sizeof(*dt), M_DEVBUF, M_NOWAIT | M_ZERO);
if (dt == NULL)
panic("could not allocate ebus dma tag");
- bzero(dt, sizeof *dt);
dt->_cookie = sc;
dt->_parent = pdt;
sc->sc_dmatag = dt;
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c
index c8a3d71faa9..fc23660c18d 100644
--- a/sys/arch/sparc64/dev/fd.c
+++ b/sys/arch/sparc64/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.18 2007/06/20 18:15:46 deraadt Exp $ */
+/* $OpenBSD: fd.c,v 1.19 2007/10/01 16:11:19 krw Exp $ */
/* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */
/*-
@@ -1943,11 +1943,10 @@ fdformat(dev, finfo, p)
struct buf *bp;
/* set up a buffer header for fdstrategy() */
- bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT);
+ bp = malloc(sizeof(*bp), M_TEMP, M_NOWAIT | M_ZERO);
if (bp == NULL)
return (ENOBUFS);
- bzero((void *)bp, sizeof(struct buf));
bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
bp->b_proc = p;
bp->b_dev = dev;
diff --git a/sys/arch/sparc64/dev/pckbc_ebus.c b/sys/arch/sparc64/dev/pckbc_ebus.c
index 82e9a942213..f2e432987bd 100644
--- a/sys/arch/sparc64/dev/pckbc_ebus.c
+++ b/sys/arch/sparc64/dev/pckbc_ebus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbc_ebus.c,v 1.7 2004/11/02 21:17:39 miod Exp $ */
+/* $OpenBSD: pckbc_ebus.c,v 1.8 2007/10/01 16:11:19 krw Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -141,8 +141,7 @@ pckbc_ebus_attach(parent, self, aux)
return;
}
- t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_NOWAIT);
- bzero(t, sizeof(struct pckbc_internal));
+ t = malloc(sizeof(*t), M_DEVBUF, M_NOWAIT | M_ZERO);
}
psc->intr_establish = pckbc_ebus_intr_establish;
diff --git a/sys/arch/vax/vsa/lcg.c b/sys/arch/vax/vsa/lcg.c
index d06f34fb6d6..a6c7eafccf1 100644
--- a/sys/arch/vax/vsa/lcg.c
+++ b/sys/arch/vax/vsa/lcg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcg.c,v 1.10 2006/11/29 12:13:54 miod Exp $ */
+/* $OpenBSD: lcg.c,v 1.11 2007/10/01 16:11:19 krw Exp $ */
/*
* Copyright (c) 2006 Miodrag Vallat.
*
@@ -247,12 +247,11 @@ lcg_attach(struct device *parent, struct device *self, void *aux)
ss = &lcg_consscr;
sc->sc_nscreens = 1;
} else {
- ss = malloc(sizeof(struct lcg_screen), M_DEVBUF, M_NOWAIT);
+ ss = malloc(sizeof(*ss), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ss == NULL) {
printf(": can not allocate memory\n");
return;
}
- bzero(ss, sizeof(struct lcg_screen));
ss->ss_cfg = cfg;
ss->ss_depth = lcg_probe_screen(ss->ss_cfg,
diff --git a/sys/arch/vax/vsa/lcspx.c b/sys/arch/vax/vsa/lcspx.c
index df4d91c8a03..818557f6837 100644
--- a/sys/arch/vax/vsa/lcspx.c
+++ b/sys/arch/vax/vsa/lcspx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcspx.c,v 1.11 2006/11/29 12:13:54 miod Exp $ */
+/* $OpenBSD: lcspx.c,v 1.12 2007/10/01 16:11:19 krw Exp $ */
/*
* Copyright (c) 2006 Miodrag Vallat.
*
@@ -232,12 +232,11 @@ lcspx_attach(struct device *parent, struct device *self, void *aux)
ss = &lcspx_consscr;
sc->sc_nscreens = 1;
} else {
- ss = malloc(sizeof(struct lcspx_screen), M_DEVBUF, M_NOWAIT);
+ ss = malloc(sizeof(*ss), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ss == NULL) {
printf(": can not allocate memory\n");
return;
}
- bzero(ss, sizeof(struct lcspx_screen));
ss->ss_addr = (caddr_t)vax_map_physmem(LCSPX_FB_ADDR,
LCSPX_FBSIZE / VAX_NBPG);
diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c
index 67c66093edb..3f0fc6ef40c 100644
--- a/sys/arch/vax/vsa/smg.c
+++ b/sys/arch/vax/vsa/smg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smg.c,v 1.19 2006/11/29 19:08:22 miod Exp $ */
+/* $OpenBSD: smg.c,v 1.20 2007/10/01 16:11:19 krw Exp $ */
/* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */
/*
* Copyright (c) 2006, Miodrag Vallat
@@ -283,12 +283,11 @@ smg_attach(struct device *parent, struct device *self, void *aux)
scr = &smg_consscr;
sc->sc_nscreens = 1;
} else {
- scr = malloc(sizeof(struct smg_screen), M_DEVBUF, M_NOWAIT);
+ scr = malloc(sizeof(*scr), M_DEVBUF, M_NOWAIT | M_ZERO);
if (scr == NULL) {
printf(": can not allocate memory\n");
return;
}
- bzero(scr, sizeof(struct smg_screen));
scr->ss_addr =
(caddr_t)vax_map_physmem(SMADDR, SMSIZE / VAX_NBPG);