More M_ZERO patches.
Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Approved by: mjacob
This commit is contained in:
parent
2b1bcb2e81
commit
1fe497ac73
@ -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,
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user