diff options
author | Charles Longeau <chl@cvs.openbsd.org> | 2007-09-27 08:45:20 +0000 |
---|---|---|
committer | Charles Longeau <chl@cvs.openbsd.org> | 2007-09-27 08:45:20 +0000 |
commit | ec828abd4e1c1eb9d94d7ecd9682cfc9def8c88d (patch) | |
tree | 100f8760fc460a82ede7d9c571389dbe5abcc57b /sys/dev/ic | |
parent | 59d2aacb9bc9f1cc0b276bf3f21778249f570b7f (diff) |
M_ZERO changes
ok dlg@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/ami.c | 23 | ||||
-rw-r--r-- | sys/dev/ic/mfi.c | 17 |
2 files changed, 13 insertions, 27 deletions
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index d1a46b97a5d..8f5669e4dd3 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.184 2007/06/24 05:34:35 dlg Exp $ */ +/* $OpenBSD: ami.c,v 1.185 2007/09/27 08:45:19 chl Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -233,11 +233,10 @@ ami_allocmem(struct ami_softc *sc, size_t size) struct ami_mem *am; int nsegs; - am = malloc(sizeof(struct ami_mem), M_DEVBUF, M_NOWAIT); + am = malloc(sizeof(struct ami_mem), M_DEVBUF, M_NOWAIT|M_ZERO); if (am == NULL) return (NULL); - memset(am, 0, sizeof(struct ami_mem)); am->am_size = size; if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, @@ -565,13 +564,12 @@ ami_attach(struct ami_softc *sc) #endif rsc = malloc(sizeof(struct ami_rawsoftc) * sc->sc_channels, - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_NOWAIT|M_ZERO); if (!rsc) { printf("%s: no memory for raw interface\n", DEVNAME(sc)); return (0); } - bzero(rsc, sizeof(struct ami_rawsoftc) * sc->sc_channels); for (sc->sc_rawsoftcs = rsc; rsc < &sc->sc_rawsoftcs[sc->sc_channels]; rsc++) { @@ -1873,7 +1871,7 @@ ami_ioctl_inq(struct ami_softc *sc, struct bioc_inq *bi) if (!p) return (ENOMEM); - plist = malloc(AMI_BIG_MAX_PDRIVES, M_DEVBUF, M_NOWAIT); + plist = malloc(AMI_BIG_MAX_PDRIVES, M_DEVBUF, M_NOWAIT|M_ZERO); if (!plist) { error = ENOMEM; goto bail; @@ -1883,8 +1881,6 @@ ami_ioctl_inq(struct ami_softc *sc, struct bioc_inq *bi) p))) goto bail2; - memset(plist, 0, AMI_BIG_MAX_PDRIVES); - bi->bi_novol = p->ada_nld; bi->bi_nodisk = 0; @@ -1950,12 +1946,10 @@ ami_vol(struct ami_softc *sc, struct bioc_vol *bv, struct ami_big_diskarray *p) int ld = p->ada_nld, error = EINVAL; u_int8_t ch, tg; - plist = malloc(AMI_BIG_MAX_PDRIVES, M_DEVBUF, M_NOWAIT); + plist = malloc(AMI_BIG_MAX_PDRIVES, M_DEVBUF, M_NOWAIT|M_ZERO); if (!plist) return (ENOMEM); - memset(plist, 0, AMI_BIG_MAX_PDRIVES); - /* setup plist */ for (i = 0; i < p->ada_nld; i++) for (s = 0; s < p->ald[i].adl_spandepth; s++) @@ -2025,12 +2019,10 @@ ami_disk(struct ami_softc *sc, struct bioc_disk *bd, int ld = p->ada_nld, error = EINVAL; u_int8_t ch, tg; - plist = malloc(AMI_BIG_MAX_PDRIVES, M_DEVBUF, M_NOWAIT); + plist = malloc(AMI_BIG_MAX_PDRIVES, M_DEVBUF, M_NOWAIT|M_ZERO); if (!plist) return (ENOMEM); - memset(plist, 0, AMI_BIG_MAX_PDRIVES); - /* setup plist */ for (i = 0; i < p->ada_nld; i++) for (s = 0; s < p->ald[i].adl_spandepth; s++) @@ -2447,10 +2439,9 @@ ami_create_sensors(struct ami_softc *sc) return (1); sc->sc_sensors = malloc(sizeof(struct ksensor) * sc->sc_nunits, - M_DEVBUF, M_WAITOK); + M_DEVBUF, M_WAITOK|M_ZERO); if (sc->sc_sensors == NULL) return (1); - bzero(sc->sc_sensors, sizeof(struct ksensor) * sc->sc_nunits); strlcpy(sc->sc_sensordev.xname, DEVNAME(sc), sizeof(sc->sc_sensordev.xname)); diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 05c404bdca1..53559f53ab0 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.73 2007/06/24 05:34:35 dlg Exp $ */ +/* $OpenBSD: mfi.c,v 1.74 2007/09/27 08:45:19 chl Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -162,8 +162,7 @@ mfi_init_ccb(struct mfi_softc *sc) DNPRINTF(MFI_D_CCB, "%s: mfi_init_ccb\n", DEVNAME(sc)); sc->sc_ccb = malloc(sizeof(struct mfi_ccb) * sc->sc_max_cmds, - M_DEVBUF, M_WAITOK); - memset(sc->sc_ccb, 0, sizeof(struct mfi_ccb) * sc->sc_max_cmds); + M_DEVBUF, M_WAITOK|M_ZERO); for (i = 0; i < sc->sc_max_cmds; i++) { ccb = &sc->sc_ccb[i]; @@ -250,11 +249,10 @@ mfi_allocmem(struct mfi_softc *sc, size_t size) DNPRINTF(MFI_D_MEM, "%s: mfi_allocmem: %d\n", DEVNAME(sc), size); - mm = malloc(sizeof(struct mfi_mem), M_DEVBUF, M_NOWAIT); + mm = malloc(sizeof(struct mfi_mem), M_DEVBUF, M_NOWAIT|M_ZERO); if (mm == NULL) return (NULL); - memset(mm, 0, sizeof(struct mfi_mem)); mm->am_size = size; if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, @@ -1410,8 +1408,7 @@ mfi_ioctl_disk(struct mfi_softc *sc, struct bioc_disk *bd) free(cfg, M_DEVBUF); /* memory for read config */ - cfg = malloc(size, M_DEVBUF, M_WAITOK); - memset(cfg, 0, size); + cfg = malloc(size, M_DEVBUF, M_WAITOK|M_ZERO); if (mfi_mgmt(sc, MD_DCMD_CONF_GET, MFI_DATA_IN, size, cfg, NULL)) goto freeme; @@ -1704,8 +1701,7 @@ mfi_bio_hs(struct mfi_softc *sc, int volid, int type, void *bio_hs) free(cfg, M_DEVBUF); /* memory for read config */ - cfg = malloc(size, M_DEVBUF, M_WAITOK); - memset(cfg, 0, size); + cfg = malloc(size, M_DEVBUF, M_WAITOK|M_ZERO); if (mfi_mgmt(sc, MD_DCMD_CONF_GET, MFI_DATA_IN, size, cfg, NULL)) goto freeme; @@ -1794,10 +1790,9 @@ mfi_create_sensors(struct mfi_softc *sc) return (1); sc->sc_sensors = malloc(sizeof(struct ksensor) * sc->sc_ld_cnt, - M_DEVBUF, M_WAITOK); + M_DEVBUF, M_WAITOK|M_ZERO); if (sc->sc_sensors == NULL) return (1); - bzero(sc->sc_sensors, sizeof(struct ksensor) * sc->sc_ld_cnt); strlcpy(sc->sc_sensordev.xname, DEVNAME(sc), sizeof(sc->sc_sensordev.xname)); |