1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

Further use of M_ZERO.

Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Approved by:	msmith
This commit is contained in:
David Malone 2000-11-18 15:21:22 +00:00
parent 99cdf4ccb2
commit ca89ee278e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=68877
5 changed files with 7 additions and 13 deletions

View File

@ -920,10 +920,9 @@ aac_alloc_command_cluster(struct aac_softc *sc)
debug_called(1);
cmc = malloc(sizeof(struct aac_command_cluster), M_DEVBUF, M_NOWAIT);
cmc = malloc(sizeof(struct aac_command_cluster), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (cmc != NULL) {
bzero(cmc, sizeof(*cmc));
/* allocate the FIB cluster in DMAable memory and load it */
if (bus_dmamem_alloc(sc->aac_fib_dmat, (void **)&cmc->cmc_fibs, BUS_DMA_NOWAIT, &cmc->cmc_fibmap)) {
free(cmc, M_DEVBUF);

View File

@ -414,11 +414,10 @@ amr_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p)
/* handle SCSI passthrough command */
if (au->au_cmd[0] == AMR_CMD_PASS) {
if ((ap = malloc(sizeof(*ap), M_DEVBUF, M_WAITOK)) == NULL) {
if ((ap = malloc(sizeof(*ap), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) {
error = ENOMEM;
break;
}
bzero(ap, sizeof(*ap));
/* copy cdb */
ap->ap_cdb_length = au->au_cmd[2];

View File

@ -319,11 +319,10 @@ amr_cam_command(struct amr_softc *sc, struct amr_command **acp)
*/
/* construct passthrough */
if ((ap = malloc(sizeof(*ap), M_DEVBUF, M_NOWAIT)) == NULL) {
if ((ap = malloc(sizeof(*ap), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
error = ENOMEM;
goto out;
}
bzero(ap, sizeof(*ap));
ap->ap_timeout = 0;
ap->ap_ars = 1;
ap->ap_request_sense_length = 14;

View File

@ -2267,9 +2267,8 @@ mlx_alloccmd(struct mlx_softc *sc)
/* allocate a new command buffer? */
if (mc == NULL) {
mc = (struct mlx_command *)malloc(sizeof(*mc), M_DEVBUF, M_NOWAIT);
mc = (struct mlx_command *)malloc(sizeof(*mc), M_DEVBUF, M_NOWAIT | M_ZERO);
if (mc != NULL) {
bzero(mc, sizeof(*mc));
mc->mc_sc = sc;
error = bus_dmamap_create(sc->mlx_buffer_dmat, 0, &mc->mc_dmamap);
if (error) {

View File

@ -296,11 +296,10 @@ mly_rescan_btl(struct mly_softc *sc, int bus, int target)
return; /* we'll be retried soon */
/* set up the data buffer */
if ((mc->mc_data = malloc(sizeof(union mly_devinfo), M_DEVBUF, M_NOWAIT)) == NULL) {
if ((mc->mc_data = malloc(sizeof(union mly_devinfo), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
mly_release_command(mc);
return; /* we'll get retried the next time a command completes */
}
bzero(mc->mc_data, sizeof(union mly_devinfo));
mc->mc_flags |= MLY_CMD_DATAIN;
mc->mc_complete = mly_complete_rescan;
@ -589,11 +588,10 @@ mly_fetch_event(struct mly_softc *sc)
return; /* we'll get retried the next time a command completes */
/* set up the data buffer */
if ((mc->mc_data = malloc(sizeof(struct mly_event), M_DEVBUF, M_NOWAIT)) == NULL) {
if ((mc->mc_data = malloc(sizeof(struct mly_event), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
mly_release_command(mc);
return; /* we'll get retried the next time a command completes */
}
bzero(mc->mc_data, sizeof(struct mly_event));
mc->mc_length = sizeof(struct mly_event);
mc->mc_flags |= MLY_CMD_DATAIN;
mc->mc_complete = mly_complete_event;