diff options
author | greid <greid@FreeBSD.org> | 2001-06-21 19:45:59 +0000 |
---|---|---|
committer | greid <greid@FreeBSD.org> | 2001-06-21 19:45:59 +0000 |
commit | d0a8512542c38acd383f36c2727baf1aa307ad91 (patch) | |
tree | 08fa50df9ce5a5907be157ee121c5a334e8dd027 /sys/dev/sound | |
parent | a0eb3fcc17fbcf0a486ed584e0b45f087f602c57 (diff) | |
download | FreeBSD-src-d0a8512542c38acd383f36c2727baf1aa307ad91.zip FreeBSD-src-d0a8512542c38acd383f36c2727baf1aa307ad91.tar.gz |
Use the M_ZERO flag to malloc(9)
Reviewed by: cg
MFC after: 1 week
Diffstat (limited to 'sys/dev/sound')
-rw-r--r-- | sys/dev/sound/isa/ad1816.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/isa/ess.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/isa/gusc.c | 15 | ||||
-rw-r--r-- | sys/dev/sound/isa/mss.c | 12 | ||||
-rw-r--r-- | sys/dev/sound/isa/sb16.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/isa/sb8.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/isa/sbc.c | 9 | ||||
-rw-r--r-- | sys/dev/sound/pci/als4000.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/aureal.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/cmi.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/cs4281.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/csa.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/csapcm.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/es137x.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/fm801.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/maestro.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/neomagic.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/solo.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/t4dwave.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/via82c686.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/vibes.c | 3 |
21 files changed, 32 insertions, 64 deletions
diff --git a/sys/dev/sound/isa/ad1816.c b/sys/dev/sound/isa/ad1816.c index 6b62c74..57e01b7 100644 --- a/sys/dev/sound/isa/ad1816.c +++ b/sys/dev/sound/isa/ad1816.c @@ -589,9 +589,8 @@ ad1816_attach(device_t dev) struct ad1816_info *ad1816; char status[SND_STATUSLEN]; - ad1816 = (struct ad1816_info *)malloc(sizeof *ad1816, M_DEVBUF, M_NOWAIT); + ad1816 = (struct ad1816_info *)malloc(sizeof *ad1816, M_DEVBUF, M_NOWAIT | M_ZERO); if (!ad1816) return ENXIO; - bzero(ad1816, sizeof *ad1816); ad1816->lock = snd_mtxcreate(device_get_nameunit(dev)); ad1816->io_rid = 2; diff --git a/sys/dev/sound/isa/ess.c b/sys/dev/sound/isa/ess.c index cb98bb7..6d619f6 100644 --- a/sys/dev/sound/isa/ess.c +++ b/sys/dev/sound/isa/ess.c @@ -799,10 +799,9 @@ ess_attach(device_t dev) char status[SND_STATUSLEN], buf[64]; int ver; - sc = (struct ess_info *)malloc(sizeof *sc, M_DEVBUF, M_NOWAIT); + sc = (struct ess_info *)malloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO); if (!sc) return ENXIO; - bzero(sc, sizeof *sc); sc->parent_dev = device_get_parent(dev); if (ess_alloc_resources(sc, dev)) diff --git a/sys/dev/sound/isa/gusc.c b/sys/dev/sound/isa/gusc.c index 283c432..1e94e83 100644 --- a/sys/dev/sound/isa/gusc.c +++ b/sys/dev/sound/isa/gusc.c @@ -123,30 +123,27 @@ gusc_probe(device_t dev) switch (logical_id) { case LOGICALID_PCM: s = "Gravis UltraSound Plug & Play PCM"; - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) return (ENOMEM); - bzero(func, sizeof(*func)); func->func = SCF_PCM; child = device_add_child(dev, "pcm", -1); device_set_ivars(child, func); break; case LOGICALID_OPL: s = "Gravis UltraSound Plug & Play OPL"; - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) return (ENOMEM); - bzero(func, sizeof(*func)); func->func = SCF_SYNTH; child = device_add_child(dev, "midi", -1); device_set_ivars(child, func); break; case LOGICALID_MIDI: s = "Gravis UltraSound Plug & Play MIDI"; - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) return (ENOMEM); - bzero(func, sizeof(*func)); func->func = SCF_MIDI; child = device_add_child(dev, "midi", -1); device_set_ivars(child, func); @@ -272,19 +269,17 @@ gusisa_probe(device_t dev) /* We can support the CS4231 and MIDI devices. */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) return ENOMEM; - bzero(func, sizeof *func); func->func = SCF_MIDI; child = device_add_child(dev, "midi", -1); device_set_ivars(child, func); - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) printf("xxx: gus pcm not attached, out of memory\n"); else { - bzero(func, sizeof *func); func->func = SCF_PCM; child = device_add_child(dev, "pcm", -1); device_set_ivars(child, func); diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c index 9c9287d..182380f 100644 --- a/sys/dev/sound/isa/mss.c +++ b/sys/dev/sound/isa/mss.c @@ -1242,9 +1242,8 @@ mss_probe(device_t dev) if (isa_get_logicalid(dev)) return ENXIO; /* not yet */ - mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT); + mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); if (!mss) return ENXIO; - bzero(mss, sizeof *mss); mss->io_rid = 0; mss->conf_rid = -1; @@ -1753,9 +1752,8 @@ mss_attach(device_t dev) struct mss_info *mss; int flags = device_get_flags(dev); - mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT); + mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); if (!mss) return ENXIO; - bzero(mss, sizeof *mss); mss->io_rid = 0; mss->conf_rid = -1; @@ -1893,10 +1891,9 @@ pnpmss_attach(device_t dev) { struct mss_info *mss; - mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT); + mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); if (!mss) return ENXIO; - bzero(mss, sizeof *mss); mss->io_rid = 0; mss->conf_rid = -1; @@ -2149,10 +2146,9 @@ guspcm_attach(device_t dev) int base, flags; unsigned char ctl; - mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT); + mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); if (mss == NULL) return ENOMEM; - bzero(mss, sizeof *mss); mss->bd_flags = BD_F_MSS_OFFSET; mss->io_rid = 2; diff --git a/sys/dev/sound/isa/sb16.c b/sys/dev/sound/isa/sb16.c index 6873591..1fcceff 100644 --- a/sys/dev/sound/isa/sb16.c +++ b/sys/dev/sound/isa/sb16.c @@ -750,10 +750,9 @@ sb16_attach(device_t dev) char status[SND_STATUSLEN]; int bs = SB16_BUFFSIZE; - sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT); + sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT | M_ZERO); if (!sb) return ENXIO; - bzero(sb, sizeof *sb); sb->parent_dev = device_get_parent(dev); BUS_READ_IVAR(sb->parent_dev, dev, 1, &ver); diff --git a/sys/dev/sound/isa/sb8.c b/sys/dev/sound/isa/sb8.c index 0a57fe4..2b924e3 100644 --- a/sys/dev/sound/isa/sb8.c +++ b/sys/dev/sound/isa/sb8.c @@ -696,10 +696,9 @@ sb_attach(device_t dev) int bs = SB_BUFFSIZE; uintptr_t ver; - sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT); + sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT | M_ZERO); if (!sb) return ENXIO; - bzero(sb, sizeof *sb); sb->parent_dev = device_get_parent(dev); BUS_READ_IVAR(device_get_parent(dev), dev, 1, &ver); diff --git a/sys/dev/sound/isa/sbc.c b/sys/dev/sound/isa/sbc.c index 2129161..e4d5dd3 100644 --- a/sys/dev/sound/isa/sbc.c +++ b/sys/dev/sound/isa/sbc.c @@ -432,25 +432,22 @@ sbc_attach(device_t dev) } /* PCM Audio */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) goto bad; - bzero(func, sizeof(*func)); func->func = SCF_PCM; scp->child_pcm = device_add_child(dev, "pcm", -1); device_set_ivars(scp->child_pcm, func); /* Midi Interface */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) goto bad; - bzero(func, sizeof(*func)); func->func = SCF_MIDI; scp->child_midi1 = device_add_child(dev, "midi", -1); device_set_ivars(scp->child_midi1, func); /* OPL FM Synthesizer */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) goto bad; - bzero(func, sizeof(*func)); func->func = SCF_SYNTH; scp->child_midi2 = device_add_child(dev, "midi", -1); device_set_ivars(scp->child_midi2, func); diff --git a/sys/dev/sound/pci/als4000.c b/sys/dev/sound/pci/als4000.c index 72352fe..16d23a3 100644 --- a/sys/dev/sound/pci/als4000.c +++ b/sys/dev/sound/pci/als4000.c @@ -755,12 +755,11 @@ als_pci_attach(device_t dev) u_int32_t data; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT)) == NULL) { + if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(sc, sizeof(*sc)); sc->dev = dev; data = pci_read_config(dev, PCIR_COMMAND, 2); diff --git a/sys/dev/sound/pci/aureal.c b/sys/dev/sound/pci/aureal.c index fbd3bd2..e629a72 100644 --- a/sys/dev/sound/pci/aureal.c +++ b/sys/dev/sound/pci/aureal.c @@ -557,12 +557,11 @@ au_pci_attach(device_t dev) struct ac97_info *codec; char status[SND_STATUSLEN]; - if ((au = malloc(sizeof(*au), M_DEVBUF, M_NOWAIT)) == NULL) { + if ((au = malloc(sizeof(*au), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(au, sizeof(*au)); au->unit = device_get_unit(dev); data = pci_read_config(dev, PCIR_COMMAND, 2); diff --git a/sys/dev/sound/pci/cmi.c b/sys/dev/sound/pci/cmi.c index aaf1d0f..585be33 100644 --- a/sys/dev/sound/pci/cmi.c +++ b/sys/dev/sound/pci/cmi.c @@ -797,12 +797,11 @@ cmi_attach(device_t dev) char status[SND_STATUSLEN]; d = device_get_softc(dev); - sc = malloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT); + sc = malloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(sc, sizeof(*sc)); data = pci_read_config(dev, PCIR_COMMAND, 2); data |= (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN); diff --git a/sys/dev/sound/pci/cs4281.c b/sys/dev/sound/pci/cs4281.c index 088761d..21a2b86 100644 --- a/sys/dev/sound/pci/cs4281.c +++ b/sys/dev/sound/pci/cs4281.c @@ -754,12 +754,11 @@ cs4281_pci_attach(device_t dev) u_int32_t data; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT)) == NULL) { + if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(sc, sizeof(*sc)); sc->dev = dev; sc->type = pci_get_devid(dev); diff --git a/sys/dev/sound/pci/csa.c b/sys/dev/sound/pci/csa.c index 6f8b732..02f37db 100644 --- a/sys/dev/sound/pci/csa.c +++ b/sys/dev/sound/pci/csa.c @@ -295,24 +295,22 @@ csa_attach(device_t dev) /* Attach the children. */ /* PCM Audio */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) { error = ENOMEM; goto err_teardown; } - bzero(func, sizeof(*func)); func->varinfo = &scp->binfo; func->func = SCF_PCM; scp->pcm = device_add_child(dev, "pcm", -1); device_set_ivars(scp->pcm, func); /* Midi Interface */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) { error = ENOMEM; goto err_teardown; } - bzero(func, sizeof(*func)); func->varinfo = &scp->binfo; func->func = SCF_MIDI; scp->midi = device_add_child(dev, "midi", -1); diff --git a/sys/dev/sound/pci/csapcm.c b/sys/dev/sound/pci/csapcm.c index 8218813..a52e08e 100644 --- a/sys/dev/sound/pci/csapcm.c +++ b/sys/dev/sound/pci/csapcm.c @@ -744,10 +744,9 @@ pcmcsa_attach(device_t dev) struct ac97_info *codec; struct sndcard_func *func; - csa = malloc(sizeof(*csa), M_DEVBUF, M_NOWAIT); + csa = malloc(sizeof(*csa), M_DEVBUF, M_NOWAIT | M_ZERO); if (csa == NULL) return (ENOMEM); - bzero(csa, sizeof(*csa)); unit = device_get_unit(dev); func = device_get_ivars(dev); csa->binfo = func->varinfo; diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index 02b1931..ca2fa0c 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -818,11 +818,10 @@ es_pci_attach(device_t dev) struct ac97_info *codec = 0; kobj_class_t ct = NULL; - if ((es = malloc(sizeof *es, M_DEVBUF, M_NOWAIT)) == NULL) { + if ((es = malloc(sizeof *es, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(es, sizeof *es); es->dev = dev; mapped = 0; diff --git a/sys/dev/sound/pci/fm801.c b/sys/dev/sound/pci/fm801.c index 25979d4..ff6fdde 100644 --- a/sys/dev/sound/pci/fm801.c +++ b/sys/dev/sound/pci/fm801.c @@ -568,12 +568,11 @@ fm801_pci_attach(device_t dev) int mapped = 0; char status[SND_STATUSLEN]; - if ((fm801 = (struct fm801_info *)malloc(sizeof(*fm801),M_DEVBUF, M_NOWAIT)) == NULL) { + if ((fm801 = (struct fm801_info *)malloc(sizeof(*fm801), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(fm801, sizeof(*fm801)); fm801->type = pci_get_devid(dev); data = pci_read_config(dev, PCIR_COMMAND, 2); diff --git a/sys/dev/sound/pci/maestro.c b/sys/dev/sound/pci/maestro.c index c93060f..140d6c9 100644 --- a/sys/dev/sound/pci/maestro.c +++ b/sys/dev/sound/pci/maestro.c @@ -956,11 +956,10 @@ agg_attach(device_t dev) void *ih = NULL; char status[SND_STATUSLEN]; - if ((ess = malloc(sizeof *ess, M_DEVBUF, M_NOWAIT)) == NULL) { + if ((ess = malloc(sizeof *ess, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(ess, sizeof *ess); ess->dev = dev; if (bus_dma_tag_create(/*parent*/NULL, diff --git a/sys/dev/sound/pci/neomagic.c b/sys/dev/sound/pci/neomagic.c index 8681cd6..4ba8615 100644 --- a/sys/dev/sound/pci/neomagic.c +++ b/sys/dev/sound/pci/neomagic.c @@ -568,8 +568,7 @@ nm_pci_probe(device_t dev) /* Try to catch other non-ac97 cards */ if (i == NUM_BADCARDS) { - if (!(sc = malloc(sizeof(*sc), M_DEVBUF, - M_NOWAIT | M_ZERO))) { + if (!(sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -627,12 +626,11 @@ nm_pci_attach(device_t dev) struct ac97_info *codec = 0; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT)) == NULL) { + if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(sc, sizeof(*sc)); sc->dev = dev; sc->type = pci_get_devid(dev); diff --git a/sys/dev/sound/pci/solo.c b/sys/dev/sound/pci/solo.c index a78ea49..c3836f1 100644 --- a/sys/dev/sound/pci/solo.c +++ b/sys/dev/sound/pci/solo.c @@ -904,10 +904,9 @@ ess_attach(device_t dev) u_int16_t ddma; u_int32_t data; - sc = (struct ess_info *)malloc(sizeof *sc, M_DEVBUF, M_NOWAIT); + sc = (struct ess_info *)malloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO); if (!sc) return ENXIO; - bzero(sc, sizeof *sc); data = pci_read_config(dev, PCIR_COMMAND, 2); data |= PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN; diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c index 1f32d31..d298ef1 100644 --- a/sys/dev/sound/pci/t4dwave.c +++ b/sys/dev/sound/pci/t4dwave.c @@ -719,12 +719,11 @@ tr_pci_attach(device_t dev) int i; char status[SND_STATUSLEN]; - if ((tr = malloc(sizeof(*tr), M_DEVBUF, M_NOWAIT)) == NULL) { + if ((tr = malloc(sizeof(*tr), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(tr, sizeof(*tr)); tr->type = pci_get_devid(dev); tr->lock = snd_mtxcreate(device_get_nameunit(dev)); diff --git a/sys/dev/sound/pci/via82c686.c b/sys/dev/sound/pci/via82c686.c index aa1d22a..b9c755e 100644 --- a/sys/dev/sound/pci/via82c686.c +++ b/sys/dev/sound/pci/via82c686.c @@ -450,11 +450,10 @@ via_attach(device_t dev) char status[SND_STATUSLEN]; u_int32_t data; - if ((via = malloc(sizeof *via, M_DEVBUF, M_NOWAIT)) == NULL) { + if ((via = malloc(sizeof *via, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } - bzero(via, sizeof *via); /* Get resources */ data = pci_read_config(dev, PCIR_COMMAND, 2); diff --git a/sys/dev/sound/pci/vibes.c b/sys/dev/sound/pci/vibes.c index 41a8c58..add787f 100644 --- a/sys/dev/sound/pci/vibes.c +++ b/sys/dev/sound/pci/vibes.c @@ -714,12 +714,11 @@ sv_attach(device_t dev) { d = device_get_softc(dev); - sc = malloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT); + sc = malloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc == NULL) { device_printf(dev, "cannot allocate softc"); return ENXIO; } - bzero(sc, sizeof(sc)); sc->dev = dev; data = pci_read_config(dev, PCIR_COMMAND, 2); |