1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

More M_ZERO patches.

Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Approved by:	mjacob
This commit is contained in:
David Malone 2000-12-03 20:46:54 +00:00
parent d6deedefeb
commit ea8b5a9ae9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69557
2 changed files with 20 additions and 25 deletions

View File

@ -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,

View File

@ -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));