diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-10-01 16:11:20 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-10-01 16:11:20 +0000 |
commit | 1d3a2c7615ad6b5663e200fe3e8a475ef3203245 (patch) | |
tree | de1c38fdba408d50ca09e62ce6c6e40d21d28491 /sys/arch/sparc | |
parent | a730dedabc875f93e81898068b1cccdb9e45cb7c (diff) |
More easy bzero() -> M_ZERO. Use 'p = malloc(sizeof(*p) ...' where
obvious.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/dev/esp.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/fd.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/xd.c | 7 | ||||
-rw-r--r-- | sys/arch/sparc/dev/xy.c | 7 |
4 files changed, 10 insertions, 14 deletions
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 |