diff options
author | mjacob <mjacob@FreeBSD.org> | 2000-10-27 16:40:57 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2000-10-27 16:40:57 +0000 |
commit | 6a129ddd436939512b11e067377ecec634a7cd4b (patch) | |
tree | 9ee4128c90816db1e7e127907b6de91025809785 | |
parent | 11f3b89daf85ef259923eb7b038364b4851c5aac (diff) | |
download | FreeBSD-src-6a129ddd436939512b11e067377ecec634a7cd4b.zip FreeBSD-src-6a129ddd436939512b11e067377ecec634a7cd4b.tar.gz |
Add usage of M_ZERO to malloc calls where the result was just bzeroed.
PR: 22186
Submitted (partially) by: josh@zipperup.org
-rw-r--r-- | sys/cam/scsi/scsi_sa.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 3743832..4251f30 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -1355,14 +1355,13 @@ saregister(struct cam_periph *periph, void *arg) return (CAM_REQ_CMP_ERR); } - softc = (struct sa_softc *)malloc(sizeof (*softc), M_DEVBUF, M_NOWAIT); + softc = (struct sa_softc *) + malloc(sizeof (*softc), M_DEVBUF, M_NOWAIT | M_ZERO); if (softc == NULL) { printf("saregister: Unable to probe new device. " "Unable to allocate softc\n"); return (CAM_REQ_CMP_ERR); } - - bzero(softc, sizeof(*softc)); softc->scsi_rev = SID_ANSI_REV(&cgd->inq_data); softc->state = SA_STATE_NORMAL; softc->fileno = (daddr_t) -1; @@ -2392,8 +2391,7 @@ retry: mode_buffer_len += sizeof (sa_comp_t); } - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK); - bzero(mode_buffer, mode_buffer_len); + mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK | M_ZERO); mode_hdr = (struct scsi_mode_header_6 *)mode_buffer; mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1]; @@ -2595,8 +2593,7 @@ sasetparams(struct cam_periph *periph, sa_params params_to_set, if (params_to_set & SA_PARAM_COMPRESSION) mode_buffer_len += sizeof (sa_comp_t); - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK); - bzero(mode_buffer, mode_buffer_len); + mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK | M_ZERO); mode_hdr = (struct scsi_mode_header_6 *)mode_buffer; mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1]; |