diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-11-11 17:47:01 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-11-11 17:47:01 +0000 |
commit | b37d7f96fb3abe514655717c4b8cf821c6eae0ca (patch) | |
tree | c132501d52744056a4897d2e74495f1919d5cd8a | |
parent | e36211dd21709c1c1efda83c64a6cf275a82a673 (diff) |
Pass a few more M_ZERO to malloc() or its wrappers, when useful; ok krw@
-rw-r--r-- | sys/arch/sparc/dev/fga.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/isp_sbus.c | 9 | ||||
-rw-r--r-- | sys/arch/sparc/dev/qe.c | 8 | ||||
-rw-r--r-- | sys/arch/sparc/dev/xd.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/atw.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/ibm561.c | 9 | ||||
-rw-r--r-- | sys/dev/ic/ncr53c9x.c | 10 |
7 files changed, 24 insertions, 30 deletions
diff --git a/sys/arch/sparc/dev/fga.c b/sys/arch/sparc/dev/fga.c index 25247aace7e..102a995725a 100644 --- a/sys/arch/sparc/dev/fga.c +++ b/sys/arch/sparc/dev/fga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fga.c,v 1.16 2010/09/20 06:33:47 matthew Exp $ */ +/* $OpenBSD: fga.c,v 1.17 2010/11/11 17:46:58 miod Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -520,10 +520,9 @@ fga_intr_establish(sc, vec, level, ih, name) /* setup vector handler */ if (sc->sc_vmevec == NULL) { sc->sc_vmevec = (struct intrhand **)malloc(256 * - sizeof(struct intrhand *), M_DEVBUF, M_NOWAIT); + sizeof(struct intrhand *), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_vmevec == NULL) panic("fga_addirq"); - bzero(sc->sc_vmevec, 256 * sizeof(struct intrhand *)); } if (sc->sc_vmevec[vec] == NULL) sc->sc_vmevec[vec] = ih; diff --git a/sys/arch/sparc/dev/isp_sbus.c b/sys/arch/sparc/dev/isp_sbus.c index bd5b062d6b2..93ad2838e43 100644 --- a/sys/arch/sparc/dev/isp_sbus.c +++ b/sys/arch/sparc/dev/isp_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_sbus.c,v 1.29 2009/08/30 21:22:25 kettenis Exp $ */ +/* $OpenBSD: isp_sbus.c,v 1.30 2010/11/11 17:46:58 miod Exp $ */ /* * SBus specific probe and attach routines for Qlogic ISP SCSI adapters. * @@ -443,11 +443,10 @@ isp_sbus_mbxdma(struct ispsoftc *isp) */ len = isp->isp_maxcmds * sizeof (XS_T); - isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK); - bzero(isp->isp_xflist, len); + isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); len = isp->isp_maxcmds * sizeof (vaddr_t); - sbc->sbus_kdma_allocs = (vaddr_t *) malloc(len, M_DEVBUF, M_WAITOK); - bzero(sbc->sbus_kdma_allocs, len); + sbc->sbus_kdma_allocs = (vaddr_t *) malloc(len, M_DEVBUF, + M_WAITOK | M_ZERO); /* * Allocate and map the request queue. diff --git a/sys/arch/sparc/dev/qe.c b/sys/arch/sparc/dev/qe.c index 44f5bfa8d3b..6df7333ea5f 100644 --- a/sys/arch/sparc/dev/qe.c +++ b/sys/arch/sparc/dev/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.32 2008/11/28 02:44:17 brad Exp $ */ +/* $OpenBSD: qe.c,v 1.33 2010/11/11 17:46:58 miod Exp $ */ /* * Copyright (c) 1998, 2000 Jason L. Wright. @@ -671,13 +671,11 @@ qeinit(sc) */ if (sc->sc_desc == NULL) sc->sc_desc_dva = (struct qe_desc *) dvma_malloc( - sizeof(struct qe_desc), &sc->sc_desc, M_NOWAIT); - bzero(sc->sc_desc, sizeof(struct qe_desc)); + sizeof(struct qe_desc), &sc->sc_desc, M_NOWAIT | M_ZERO); if (sc->sc_bufs == NULL) sc->sc_bufs_dva = (struct qe_bufs *) dvma_malloc( - sizeof(struct qe_bufs), &sc->sc_bufs, M_NOWAIT); - bzero(sc->sc_bufs, sizeof(struct qe_bufs)); + sizeof(struct qe_bufs), &sc->sc_bufs, M_NOWAIT | M_ZERO); for (i = 0; i < QE_TX_RING_MAXSIZE; i++) sc->sc_desc->qe_txd[i].tx_addr = diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c index c61b96affc5..c284d4e8390 100644 --- a/sys/arch/sparc/dev/xd.c +++ b/sys/arch/sparc/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.52 2010/09/22 06:40:25 krw Exp $ */ +/* $OpenBSD: xd.c,v 1.53 2010/11/11 17:46:58 miod Exp $ */ /* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */ /* @@ -413,9 +413,8 @@ xdcattach(parent, self, aux) xdc->dvmaiopb = (struct xd_iopb *) dvma_malloc(XDC_MAXIOPB * sizeof(struct xd_iopb), &xdc->iopbase, - M_NOWAIT); + M_NOWAIT | M_ZERO); xdc->iopbase = xdc->dvmaiopb; /* XXX TMP HACK */ - bzero(xdc->iopbase, XDC_MAXIOPB * sizeof(struct xd_iopb)); /* Setup device view of DVMA address */ xdc->dvmaiopb = (struct xd_iopb *) ((u_long) xdc->iopbase - DVMA_BASE); diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index fb04ad2809c..f62a6f67053 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atw.c,v 1.74 2010/09/20 00:11:37 jsg Exp $ */ +/* $OpenBSD: atw.c,v 1.75 2010/11/11 17:47:00 miod Exp $ */ /* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */ /*- @@ -397,15 +397,15 @@ atw_read_srom(struct atw_softc *sc) return -1; } - sc->sc_srom = malloc(sc->sc_sromsz, M_DEVBUF, M_NOWAIT); + sc->sc_srom = malloc(sc->sc_sromsz, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_srom == NULL) { printf("%s: unable to allocate SROM buffer\n", sc->sc_dev.dv_xname); return -1; } - (void)memset(sc->sc_srom, 0, sc->sc_sromsz); - /* ADM8211 has a single 32-bit register for controlling the + /* + * ADM8211 has a single 32-bit register for controlling the * 93cx6 SROM. Bit SRS enables the serial port. There is no * "ready" bit. The ADM8211 input/output sense is the reverse * of read_seeprom's. diff --git a/sys/dev/ic/ibm561.c b/sys/dev/ic/ibm561.c index 353ddbc0961..d9310553ed6 100644 --- a/sys/dev/ic/ibm561.c +++ b/sys/dev/ic/ibm561.c @@ -1,5 +1,5 @@ /* $NetBSD: ibm561.c,v 1.1 2001/12/12 07:46:48 elric Exp $ */ -/* $OpenBSD: ibm561.c,v 1.5 2008/06/26 05:42:15 ray Exp $ */ +/* $OpenBSD: ibm561.c,v 1.6 2010/11/11 17:47:00 miod Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -151,10 +151,9 @@ ibm561_register(v, sched_update, wr, rd) { struct ibm561data *data; - if (ibm561_console_data.cookie == NULL) { - data = malloc(sizeof *data, M_DEVBUF, M_WAITOK); - bzero(data, sizeof *data); - } else + if (ibm561_console_data.cookie == NULL) + data = malloc(sizeof *data, M_DEVBUF, M_WAITOK | M_ZERO); + else data = &ibm561_console_data; data->cookie = v; data->ramdac_sched_update = sched_update; diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index 4c8a6413304..8ecb2ed04b9 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr53c9x.c,v 1.49 2010/09/28 01:50:08 deraadt Exp $ */ +/* $OpenBSD: ncr53c9x.c,v 1.50 2010/11/11 17:47:00 miod Exp $ */ /* $NetBSD: ncr53c9x.c,v 1.56 2000/11/30 14:41:46 thorpej Exp $ */ /* @@ -807,12 +807,12 @@ ncr53c9x_scsi_cmd(xs) li = TINFO_LUN(ti, lun); if (li == NULL) { /* Initialize LUN info and add to list. */ - if ((li = malloc(sizeof(*li), M_DEVBUF, M_NOWAIT)) == NULL) { + if ((li = malloc(sizeof(*li), M_DEVBUF, + M_NOWAIT | M_ZERO)) == NULL) { xs->error = XS_NO_CCB; scsi_done(xs); return; } - bzero(li, sizeof(*li)); li->last_used = time_second; li->lun = lun; s = splbio(); @@ -954,11 +954,11 @@ ncr53c9x_sched(sc) li = TINFO_LUN(ti, lun); if (!li) { /* Initialize LUN info and add to list. */ - if ((li = malloc(sizeof(*li), M_DEVBUF, M_NOWAIT)) == NULL) { + if ((li = malloc(sizeof(*li), M_DEVBUF, + M_NOWAIT | M_ZERO)) == NULL) { splx(s); continue; } - bzero(li, sizeof(*li)); li->lun = lun; LIST_INSERT_HEAD(&ti->luns, li, link); |