diff options
author | sos <sos@FreeBSD.org> | 2000-12-26 12:05:49 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2000-12-26 12:05:49 +0000 |
commit | 1b1f7bb47925f50466bb3cde13f1b061102c23e8 (patch) | |
tree | 9fefcfe2b9b6a40ce4eed69cc792c229e32e71b9 /sys/dev/ata | |
parent | 391df2055e2de4a517b02e3a14f985e31572f072 (diff) | |
download | FreeBSD-src-1b1f7bb47925f50466bb3cde13f1b061102c23e8.zip FreeBSD-src-1b1f7bb47925f50466bb3cde13f1b061102c23e8.tar.gz |
Use M_ZERO flag on malloc when approbiate.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/ata-all.c | 5 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.c | 6 | ||||
-rw-r--r-- | sys/dev/ata/ata-raid.c | 7 | ||||
-rw-r--r-- | sys/dev/ata/atapi-all.c | 7 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 10 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 3 | ||||
-rw-r--r-- | sys/dev/ata/atapi-tape.c | 3 |
7 files changed, 16 insertions, 25 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 1ab81e4..024a158 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -1794,12 +1794,11 @@ ata_init(void) { /* register boot attach to be run when interrupts are enabled */ if (!(ata_delayed_attach = (struct intr_config_hook *) - malloc(sizeof(struct intr_config_hook), - M_TEMP, M_NOWAIT))) { + malloc(sizeof(struct intr_config_hook), + M_TEMP, M_NOWAIT | M_ZERO))) { printf("ata: malloc of delayed attach hook failed\n"); return; } - bzero(ata_delayed_attach, sizeof(struct intr_config_hook)); ata_delayed_attach->ich_func = (void*)ata_boot_attach; if (config_intrhook_establish(ata_delayed_attach) != 0) { diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 36da5b7..5cc8b32 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -97,11 +97,10 @@ ad_attach(struct ata_softc *scp, int device) int secsperint; - if (!(adp = malloc(sizeof(struct ad_softc), M_AD, M_NOWAIT))) { + if (!(adp = malloc(sizeof(struct ad_softc), M_AD, M_NOWAIT | M_ZERO))) { ata_printf(scp, device, "failed to allocate driver storage\n"); return; } - bzero(adp, sizeof(struct ad_softc)); scp->dev_softc[ATA_DEV(device)] = adp; adp->controller = scp; adp->unit = device; @@ -351,13 +350,12 @@ ad_start(struct ad_softc *adp) return; } - if (!(request = malloc(sizeof(struct ad_request), M_AD, M_NOWAIT))) { + if (!(request = malloc(sizeof(struct ad_request), M_AD, M_NOWAIT|M_ZERO))) { printf("ad%d: out of memory in start\n", adp->lun); return; } /* setup request */ - bzero(request, sizeof(struct ad_request)); request->device = adp; request->bp = bp; request->blockaddr = bp->bio_pblkno; diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index bc9cbe4..d361e45 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -183,8 +183,7 @@ arstrategy(struct bio *bp) struct ar_buf *buf1, *buf2; int plba; - buf1 = malloc(sizeof(struct ar_buf), M_AR, M_NOWAIT); - bzero(buf1, sizeof(struct ar_buf)); + buf1 = malloc(sizeof(struct ar_buf), M_AR, M_NOWAIT | M_ZERO); if (rdp->flags & AR_F_SPAN) { plba = lba; while (plba >= (rdp->subdisk[buf1->drive]->total_secs-rdp->reserved) @@ -315,12 +314,12 @@ ar_highpoint_conf(struct ad_softc *adp, struct ar_softc **raidp) for (array = 0; array < 8; array++) { if (!raidp[array]) { raidp[array] = - (struct ar_softc*)malloc(sizeof(struct ar_softc),M_AR,M_NOWAIT); + (struct ar_softc*)malloc(sizeof(struct ar_softc),M_AR, + M_NOWAIT | M_ZERO); if (!raidp[array]) { printf("ar: failed to allocate raid config storage\n"); return 1; } - bzero(raidp[array], sizeof(struct ar_softc)); } raid = raidp[array]; diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c index abb4771..afc19f6 100644 --- a/sys/dev/ata/atapi-all.c +++ b/sys/dev/ata/atapi-all.c @@ -62,11 +62,10 @@ atapi_attach(struct ata_softc *scp, int device) { struct atapi_softc *atp; - if (!(atp = malloc(sizeof(struct atapi_softc), M_ATAPI, M_NOWAIT))) { + if (!(atp = malloc(sizeof(struct atapi_softc), M_ATAPI, M_NOWAIT|M_ZERO))) { ata_printf(scp, device, "failed to allocate driver storage\n"); return; } - bzero(atp, sizeof(struct atapi_softc)); atp->controller = scp; atp->unit = device; if (bootverbose) @@ -154,10 +153,10 @@ atapi_queue_cmd(struct atapi_softc *atp, int8_t *ccb, caddr_t data, struct atapi_request *request; int error, s; - if (!(request = malloc(sizeof(struct atapi_request), M_ATAPI, M_NOWAIT))) + if (!(request = malloc(sizeof(struct atapi_request), M_ATAPI, + M_NOWAIT | M_ZERO))) return ENOMEM; - bzero(request, sizeof(struct atapi_request)); request->device = atp; request->data = data; request->bytecount = count; diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 1e0c01e..33e8cf9 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -143,13 +143,12 @@ acdattach(struct atapi_softc *atp) sizeof(struct changer)>>8, sizeof(struct changer), 0, 0, 0, 0, 0, 0 }; - chp = malloc(sizeof(struct changer), M_ACD, M_NOWAIT); + chp = malloc(sizeof(struct changer), M_ACD, M_NOWAIT | M_ZERO); if (chp == NULL) { printf("acd: out of memory\n"); free(cdp, M_ACD); return -1; } - bzero(chp, sizeof(struct changer)); error = atapi_queue_cmd(cdp->atp, ccb, (caddr_t)chp, sizeof(struct changer), ATPR_F_READ, 60, NULL, NULL); @@ -233,9 +232,8 @@ acd_init_lun(struct atapi_softc *atp, struct devstat *stats) { struct acd_softc *cdp; - if (!(cdp = malloc(sizeof(struct acd_softc), M_ACD, M_NOWAIT))) + if (!(cdp = malloc(sizeof(struct acd_softc), M_ACD, M_NOWAIT | M_ZERO))) return NULL; - bzero(cdp, sizeof(struct acd_softc)); bioq_init(&cdp->bio_queue); cdp->atp = atp; cdp->lun = ata_get_lun(&acd_lun_map); @@ -243,11 +241,11 @@ acd_init_lun(struct atapi_softc *atp, struct devstat *stats) cdp->slot = -1; cdp->changer_info = NULL; if (stats == NULL) { - if (!(cdp->stats = malloc(sizeof(struct devstat), M_ACD, M_NOWAIT))) { + if (!(cdp->stats = malloc(sizeof(struct devstat), M_ACD, + M_NOWAIT | M_ZERO))) { free(cdp, M_ACD); return NULL; } - bzero(cdp->stats, sizeof(struct devstat)); } else cdp->stats = stats; diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 84398a0..3f16083 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -84,12 +84,11 @@ afdattach(struct atapi_softc *atp) struct afd_softc *fdp; dev_t dev; - fdp = malloc(sizeof(struct afd_softc), M_AFD, M_NOWAIT); + fdp = malloc(sizeof(struct afd_softc), M_AFD, M_NOWAIT | M_ZERO); if (!fdp) { printf("afd: out of memory\n"); return -1; } - bzero(fdp, sizeof(struct afd_softc)); bioq_init(&fdp->bio_queue); fdp->atp = atp; fdp->lun = ata_get_lun(&afd_lun_map); diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index e590958..5c7b59a 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -96,12 +96,11 @@ astattach(struct atapi_softc *atp) cdevsw_add(&ast_cdevsw); ast_cdev_done = 1; } - stp = malloc(sizeof(struct ast_softc), M_AST, M_NOWAIT); + stp = malloc(sizeof(struct ast_softc), M_AST, M_NOWAIT | M_ZERO); if (!stp) { printf("ast: out of memory\n"); return -1; } - bzero(stp, sizeof(struct ast_softc)); bioq_init(&stp->bio_queue); stp->atp = atp; stp->lun = ata_get_lun(&ast_lun_map); |