diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2000-12-03 20:46:54 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2000-12-03 20:46:54 +0000 |
commit | 1fe497ac735107937d9e75edac22359ee806486a (patch) | |
tree | e3bcdda5261e2df0f279278ccc55dd5569164006 | |
parent | 2b1bcb2e8199bfceb6dae06d720335edf4569154 (diff) | |
download | FreeBSD-src-1fe497ac735107937d9e75edac22359ee806486a.zip FreeBSD-src-1fe497ac735107937d9e75edac22359ee806486a.tar.gz |
More M_ZERO patches.
Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>
Approved by: mjacob
-rw-r--r-- | sys/alpha/alpha/busdma_machdep.c | 42 | ||||
-rw-r--r-- | sys/dev/isp/isp_freebsd.c | 3 |
2 files changed, 20 insertions, 25 deletions
diff --git a/sys/alpha/alpha/busdma_machdep.c b/sys/alpha/alpha/busdma_machdep.c index fff99d5..2cc55d2 100644 --- a/sys/alpha/alpha/busdma_machdep.c +++ b/sys/alpha/alpha/busdma_machdep.c @@ -246,21 +246,19 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) if ((dmat->flags & BUS_DMA_ISA) && chipset.sgmap != NULL) { bus_dmamap_t map; - map = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, - M_NOWAIT); - if (map == NULL) { + map = (bus_dmamap_t)malloc(sizeof(*map), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (map == NULL) return (ENOMEM); - } else { - bzero(map, sizeof(*map)); - map->busaddress = - sgmap_alloc_region(chipset.sgmap, - dmat->maxsize, - dmat->boundary, - &map->sgmaphandle); - dmat->map_count++; - *mapp = map; - return (0); - } + + map->busaddress = + sgmap_alloc_region(chipset.sgmap, + dmat->maxsize, + dmat->boundary, + &map->sgmaphandle); + dmat->map_count++; + *mapp = map; + return (0); } if (dmat->lowaddr < ptoa(Maxmem)) { @@ -268,14 +266,13 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) int maxpages; *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, - M_NOWAIT); - if (*mapp == NULL) { + M_NOWAIT | M_ZERO); + if (*mapp == NULL) return (ENOMEM); - } else { - /* Initialize the new map */ - bzero(*mapp, sizeof(**mapp)); - STAILQ_INIT(&((*mapp)->bpages)); - } + + /* Initialize the new map */ + STAILQ_INIT(&((*mapp)->bpages)); + /* * Attempt to add pages to our pool on a per-instance * basis up to a sane limit. @@ -603,11 +600,10 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) struct bounce_page *bpage; bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, - M_NOWAIT); + M_NOWAIT | M_ZERO); if (bpage == NULL) break; - bzero(bpage, sizeof(*bpage)); bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0ul, dmat->lowaddr, diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index c3157b3..66621e3 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -319,11 +319,10 @@ create_lun_state(struct ispsoftc *isp, struct cam_path *path, tstate_t **rslt) if (is_lun_enabled(isp, lun)) { return (CAM_LUN_ALRDY_ENA); } - new = (tstate_t *) malloc(sizeof (tstate_t), M_DEVBUF, M_NOWAIT); + new = (tstate_t *) malloc(sizeof (tstate_t), M_DEVBUF, M_NOWAIT|M_ZERO); if (new == NULL) { return (CAM_RESRC_UNAVAIL); } - bzero(new, sizeof (tstate_t)); status = xpt_create_path(&new->owner, NULL, xpt_path_path_id(path), xpt_path_target_id(path), xpt_path_lun_id(path)); |