diff options
author | Robert P. J. Day <rpjday@mindspring.com> | 2007-02-14 03:33:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-14 11:09:54 -0500 |
commit | 3159f06dc2303630c02d1ad2eeaeaf341414c9df (patch) | |
tree | 678779f605dac635df3932381933b3950a0052ba /sound/oss | |
parent | cd354f1ae75e6466a7e31b727faede57a1f89ca5 (diff) |
[PATCH] OSS: replace kmalloc()+memset() combos with kzalloc()
Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls.
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'sound/oss')
-rw-r--r-- | sound/oss/ac97_codec.c | 3 | ||||
-rw-r--r-- | sound/oss/ad1889.c | 3 | ||||
-rw-r--r-- | sound/oss/btaudio.c | 3 | ||||
-rw-r--r-- | sound/oss/cs46xx.c | 9 | ||||
-rw-r--r-- | sound/oss/dmasound/dac3550a.c | 3 | ||||
-rw-r--r-- | sound/oss/dmasound/tas3001c.c | 3 | ||||
-rw-r--r-- | sound/oss/dmasound/tas3004.c | 3 | ||||
-rw-r--r-- | sound/oss/dmasound/tas_common.c | 3 | ||||
-rw-r--r-- | sound/oss/emu10k1/main.c | 11 | ||||
-rw-r--r-- | sound/oss/es1371.c | 3 | ||||
-rw-r--r-- | sound/oss/hal2.c | 3 | ||||
-rw-r--r-- | sound/oss/i810_audio.c | 9 | ||||
-rw-r--r-- | sound/oss/kahlua.c | 3 | ||||
-rw-r--r-- | sound/oss/nec_vrc5477.c | 3 | ||||
-rw-r--r-- | sound/oss/opl3.c | 3 | ||||
-rw-r--r-- | sound/oss/sb_card.c | 6 | ||||
-rw-r--r-- | sound/oss/swarm_cs4297a.c | 13 | ||||
-rw-r--r-- | sound/oss/trident.c | 9 | ||||
-rw-r--r-- | sound/oss/waveartist.c | 4 |
19 files changed, 32 insertions, 65 deletions
diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c index 602db497929a..fef56cac06c8 100644 --- a/sound/oss/ac97_codec.c +++ b/sound/oss/ac97_codec.c | |||
@@ -744,11 +744,10 @@ static int ac97_check_modem(struct ac97_codec *codec) | |||
744 | 744 | ||
745 | struct ac97_codec *ac97_alloc_codec(void) | 745 | struct ac97_codec *ac97_alloc_codec(void) |
746 | { | 746 | { |
747 | struct ac97_codec *codec = kmalloc(sizeof(struct ac97_codec), GFP_KERNEL); | 747 | struct ac97_codec *codec = kzalloc(sizeof(struct ac97_codec), GFP_KERNEL); |
748 | if(!codec) | 748 | if(!codec) |
749 | return NULL; | 749 | return NULL; |
750 | 750 | ||
751 | memset(codec, 0, sizeof(*codec)); | ||
752 | spin_lock_init(&codec->lock); | 751 | spin_lock_init(&codec->lock); |
753 | INIT_LIST_HEAD(&codec->list); | 752 | INIT_LIST_HEAD(&codec->list); |
754 | return codec; | 753 | return codec; |
diff --git a/sound/oss/ad1889.c b/sound/oss/ad1889.c index f0724327493c..c0730a3563a2 100644 --- a/sound/oss/ad1889.c +++ b/sound/oss/ad1889.c | |||
@@ -230,9 +230,8 @@ static ad1889_dev_t *ad1889_alloc_dev(struct pci_dev *pci) | |||
230 | struct dmabuf *dmabuf; | 230 | struct dmabuf *dmabuf; |
231 | int i; | 231 | int i; |
232 | 232 | ||
233 | if ((dev = kmalloc(sizeof(ad1889_dev_t), GFP_KERNEL)) == NULL) | 233 | if ((dev = kzalloc(sizeof(ad1889_dev_t), GFP_KERNEL)) == NULL) |
234 | return NULL; | 234 | return NULL; |
235 | memset(dev, 0, sizeof(ad1889_dev_t)); | ||
236 | spin_lock_init(&dev->lock); | 235 | spin_lock_init(&dev->lock); |
237 | dev->pci = pci; | 236 | dev->pci = pci; |
238 | 237 | ||
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c index f845528e1fac..f813ae9c2134 100644 --- a/sound/oss/btaudio.c +++ b/sound/oss/btaudio.c | |||
@@ -915,12 +915,11 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev, | |||
915 | return -EBUSY; | 915 | return -EBUSY; |
916 | } | 916 | } |
917 | 917 | ||
918 | bta = kmalloc(sizeof(*bta),GFP_ATOMIC); | 918 | bta = kzalloc(sizeof(*bta),GFP_ATOMIC); |
919 | if (!bta) { | 919 | if (!bta) { |
920 | rc = -ENOMEM; | 920 | rc = -ENOMEM; |
921 | goto fail0; | 921 | goto fail0; |
922 | } | 922 | } |
923 | memset(bta,0,sizeof(*bta)); | ||
924 | 923 | ||
925 | bta->pci = pci_dev; | 924 | bta->pci = pci_dev; |
926 | bta->irq = pci_dev->irq; | 925 | bta->irq = pci_dev->irq; |
diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c index 147c8a951137..2a1f0d9ac968 100644 --- a/sound/oss/cs46xx.c +++ b/sound/oss/cs46xx.c | |||
@@ -3048,10 +3048,9 @@ static int cs_open(struct inode *inode, struct file *file) | |||
3048 | CS_DBGOUT(CS_WAVE_READ, 2, printk("cs46xx: cs_open() FMODE_READ\n") ); | 3048 | CS_DBGOUT(CS_WAVE_READ, 2, printk("cs46xx: cs_open() FMODE_READ\n") ); |
3049 | if (card->states[0] == NULL) { | 3049 | if (card->states[0] == NULL) { |
3050 | state = card->states[0] = | 3050 | state = card->states[0] = |
3051 | kmalloc(sizeof(struct cs_state), GFP_KERNEL); | 3051 | kzalloc(sizeof(struct cs_state), GFP_KERNEL); |
3052 | if (state == NULL) | 3052 | if (state == NULL) |
3053 | return -ENOMEM; | 3053 | return -ENOMEM; |
3054 | memset(state, 0, sizeof(struct cs_state)); | ||
3055 | mutex_init(&state->sem); | 3054 | mutex_init(&state->sem); |
3056 | dmabuf = &state->dmabuf; | 3055 | dmabuf = &state->dmabuf; |
3057 | dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); | 3056 | dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); |
@@ -3114,10 +3113,9 @@ static int cs_open(struct inode *inode, struct file *file) | |||
3114 | CS_DBGOUT(CS_OPEN, 2, printk("cs46xx: cs_open() FMODE_WRITE\n") ); | 3113 | CS_DBGOUT(CS_OPEN, 2, printk("cs46xx: cs_open() FMODE_WRITE\n") ); |
3115 | if (card->states[1] == NULL) { | 3114 | if (card->states[1] == NULL) { |
3116 | state = card->states[1] = | 3115 | state = card->states[1] = |
3117 | kmalloc(sizeof(struct cs_state), GFP_KERNEL); | 3116 | kzalloc(sizeof(struct cs_state), GFP_KERNEL); |
3118 | if (state == NULL) | 3117 | if (state == NULL) |
3119 | return -ENOMEM; | 3118 | return -ENOMEM; |
3120 | memset(state, 0, sizeof(struct cs_state)); | ||
3121 | mutex_init(&state->sem); | 3119 | mutex_init(&state->sem); |
3122 | dmabuf = &state->dmabuf; | 3120 | dmabuf = &state->dmabuf; |
3123 | dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); | 3121 | dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); |
@@ -5075,11 +5073,10 @@ static int __devinit cs46xx_probe(struct pci_dev *pci_dev, | |||
5075 | pci_read_config_word(pci_dev, PCI_SUBSYSTEM_VENDOR_ID, &ss_vendor); | 5073 | pci_read_config_word(pci_dev, PCI_SUBSYSTEM_VENDOR_ID, &ss_vendor); |
5076 | pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, &ss_card); | 5074 | pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, &ss_card); |
5077 | 5075 | ||
5078 | if ((card = kmalloc(sizeof(struct cs_card), GFP_KERNEL)) == NULL) { | 5076 | if ((card = kzalloc(sizeof(struct cs_card), GFP_KERNEL)) == NULL) { |
5079 | printk(KERN_ERR "cs46xx: out of memory\n"); | 5077 | printk(KERN_ERR "cs46xx: out of memory\n"); |
5080 | return -ENOMEM; | 5078 | return -ENOMEM; |
5081 | } | 5079 | } |
5082 | memset(card, 0, sizeof(*card)); | ||
5083 | card->ba0_addr = RSRCADDRESS(pci_dev, 0); | 5080 | card->ba0_addr = RSRCADDRESS(pci_dev, 0); |
5084 | card->ba1_addr = RSRCADDRESS(pci_dev, 1); | 5081 | card->ba1_addr = RSRCADDRESS(pci_dev, 1); |
5085 | card->pci_dev = pci_dev; | 5082 | card->pci_dev = pci_dev; |
diff --git a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c index 7360d8954d60..0f0d03a55dab 100644 --- a/sound/oss/dmasound/dac3550a.c +++ b/sound/oss/dmasound/dac3550a.c | |||
@@ -163,10 +163,9 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address) | |||
163 | struct i2c_client *new_client; | 163 | struct i2c_client *new_client; |
164 | int rc = -ENODEV; | 164 | int rc = -ENODEV; |
165 | 165 | ||
166 | new_client = kmalloc(sizeof(*new_client), GFP_KERNEL); | 166 | new_client = kzalloc(sizeof(*new_client), GFP_KERNEL); |
167 | if (!new_client) | 167 | if (!new_client) |
168 | return -ENOMEM; | 168 | return -ENOMEM; |
169 | memset(new_client, 0, sizeof(*new_client)); | ||
170 | 169 | ||
171 | new_client->addr = address; | 170 | new_client->addr = address; |
172 | new_client->adapter = adapter; | 171 | new_client->adapter = adapter; |
diff --git a/sound/oss/dmasound/tas3001c.c b/sound/oss/dmasound/tas3001c.c index 2f21a3c00374..4b7dbdd2a438 100644 --- a/sound/oss/dmasound/tas3001c.c +++ b/sound/oss/dmasound/tas3001c.c | |||
@@ -807,10 +807,9 @@ tas3001c_init(struct i2c_client *client) | |||
807 | size_t sz = sizeof(*self) + (TAS3001C_REG_MAX*sizeof(tas_shadow_t)); | 807 | size_t sz = sizeof(*self) + (TAS3001C_REG_MAX*sizeof(tas_shadow_t)); |
808 | int i, j; | 808 | int i, j; |
809 | 809 | ||
810 | self = kmalloc(sz, GFP_KERNEL); | 810 | self = kzalloc(sz, GFP_KERNEL); |
811 | if (!self) | 811 | if (!self) |
812 | return -ENOMEM; | 812 | return -ENOMEM; |
813 | memset(self, 0, sz); | ||
814 | 813 | ||
815 | self->super.client = client; | 814 | self->super.client = client; |
816 | self->super.shadow = (tas_shadow_t *)(self+1); | 815 | self->super.shadow = (tas_shadow_t *)(self+1); |
diff --git a/sound/oss/dmasound/tas3004.c b/sound/oss/dmasound/tas3004.c index af34fb39bc29..678bf0ff6da2 100644 --- a/sound/oss/dmasound/tas3004.c +++ b/sound/oss/dmasound/tas3004.c | |||
@@ -1092,10 +1092,9 @@ tas3004_init(struct i2c_client *client) | |||
1092 | char mcr2 = 0; | 1092 | char mcr2 = 0; |
1093 | int i, j; | 1093 | int i, j; |
1094 | 1094 | ||
1095 | self = kmalloc(sz, GFP_KERNEL); | 1095 | self = kzalloc(sz, GFP_KERNEL); |
1096 | if (!self) | 1096 | if (!self) |
1097 | return -ENOMEM; | 1097 | return -ENOMEM; |
1098 | memset(self, 0, sz); | ||
1099 | 1098 | ||
1100 | self->super.client = client; | 1099 | self->super.client = client; |
1101 | self->super.shadow = (tas_shadow_t *)(self+1); | 1100 | self->super.shadow = (tas_shadow_t *)(self+1); |
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index 882ae98a41b1..665e85b5562b 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c | |||
@@ -135,10 +135,9 @@ tas_detect_client(struct i2c_adapter *adapter, int address) | |||
135 | return -ENODEV; | 135 | return -ENODEV; |
136 | } | 136 | } |
137 | 137 | ||
138 | new_client = kmalloc(sizeof(*new_client), GFP_KERNEL); | 138 | new_client = kzalloc(sizeof(*new_client), GFP_KERNEL); |
139 | if (!new_client) | 139 | if (!new_client) |
140 | return -ENOMEM; | 140 | return -ENOMEM; |
141 | memset(new_client, 0, sizeof(*new_client)); | ||
142 | 141 | ||
143 | new_client->addr = address; | 142 | new_client->addr = address; |
144 | new_client->adapter = adapter; | 143 | new_client->adapter = adapter; |
diff --git a/sound/oss/emu10k1/main.c b/sound/oss/emu10k1/main.c index 6c59df7b0001..16ac02540a3f 100644 --- a/sound/oss/emu10k1/main.c +++ b/sound/oss/emu10k1/main.c | |||
@@ -455,15 +455,13 @@ static int __devinit emu10k1_midi_init(struct emu10k1_card *card) | |||
455 | { | 455 | { |
456 | int ret; | 456 | int ret; |
457 | 457 | ||
458 | card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL); | 458 | card->mpuout = kzalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL); |
459 | if (card->mpuout == NULL) { | 459 | if (card->mpuout == NULL) { |
460 | printk(KERN_WARNING "emu10k1: Unable to allocate emu10k1_mpuout: out of memory\n"); | 460 | printk(KERN_WARNING "emu10k1: Unable to allocate emu10k1_mpuout: out of memory\n"); |
461 | ret = -ENOMEM; | 461 | ret = -ENOMEM; |
462 | goto err_out1; | 462 | goto err_out1; |
463 | } | 463 | } |
464 | 464 | ||
465 | memset(card->mpuout, 0, sizeof(struct emu10k1_mpuout)); | ||
466 | |||
467 | card->mpuout->intr = 1; | 465 | card->mpuout->intr = 1; |
468 | card->mpuout->status = FLAGS_AVAILABLE; | 466 | card->mpuout->status = FLAGS_AVAILABLE; |
469 | card->mpuout->state = CARDMIDIOUT_STATE_DEFAULT; | 467 | card->mpuout->state = CARDMIDIOUT_STATE_DEFAULT; |
@@ -472,15 +470,13 @@ static int __devinit emu10k1_midi_init(struct emu10k1_card *card) | |||
472 | 470 | ||
473 | spin_lock_init(&card->mpuout->lock); | 471 | spin_lock_init(&card->mpuout->lock); |
474 | 472 | ||
475 | card->mpuin = kmalloc(sizeof(struct emu10k1_mpuin), GFP_KERNEL); | 473 | card->mpuin = kzalloc(sizeof(struct emu10k1_mpuin), GFP_KERNEL); |
476 | if (card->mpuin == NULL) { | 474 | if (card->mpuin == NULL) { |
477 | printk(KERN_WARNING "emu10k1: Unable to allocate emu10k1_mpuin: out of memory\n"); | 475 | printk(KERN_WARNING "emu10k1: Unable to allocate emu10k1_mpuin: out of memory\n"); |
478 | ret = -ENOMEM; | 476 | ret = -ENOMEM; |
479 | goto err_out2; | 477 | goto err_out2; |
480 | } | 478 | } |
481 | 479 | ||
482 | memset(card->mpuin, 0, sizeof(struct emu10k1_mpuin)); | ||
483 | |||
484 | card->mpuin->status = FLAGS_AVAILABLE; | 480 | card->mpuin->status = FLAGS_AVAILABLE; |
485 | 481 | ||
486 | tasklet_init(&card->mpuin->tasklet, emu10k1_mpuin_bh, (unsigned long) card->mpuin); | 482 | tasklet_init(&card->mpuin->tasklet, emu10k1_mpuin_bh, (unsigned long) card->mpuin); |
@@ -1280,11 +1276,10 @@ static int __devinit emu10k1_probe(struct pci_dev *pci_dev, const struct pci_dev | |||
1280 | 1276 | ||
1281 | pci_set_master(pci_dev); | 1277 | pci_set_master(pci_dev); |
1282 | 1278 | ||
1283 | if ((card = kmalloc(sizeof(struct emu10k1_card), GFP_KERNEL)) == NULL) { | 1279 | if ((card = kzalloc(sizeof(struct emu10k1_card), GFP_KERNEL)) == NULL) { |
1284 | printk(KERN_ERR "emu10k1: out of memory\n"); | 1280 | printk(KERN_ERR "emu10k1: out of memory\n"); |
1285 | return -ENOMEM; | 1281 | return -ENOMEM; |
1286 | } | 1282 | } |
1287 | memset(card, 0, sizeof(struct emu10k1_card)); | ||
1288 | 1283 | ||
1289 | card->iobase = pci_resource_start(pci_dev, 0); | 1284 | card->iobase = pci_resource_start(pci_dev, 0); |
1290 | card->length = pci_resource_len(pci_dev, 0); | 1285 | card->length = pci_resource_len(pci_dev, 0); |
diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c index e1fbcca8e722..974dd732b149 100644 --- a/sound/oss/es1371.c +++ b/sound/oss/es1371.c | |||
@@ -2871,11 +2871,10 @@ static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_devic | |||
2871 | printk(KERN_WARNING "es1371: architecture does not support 32bit PCI busmaster DMA\n"); | 2871 | printk(KERN_WARNING "es1371: architecture does not support 32bit PCI busmaster DMA\n"); |
2872 | return i; | 2872 | return i; |
2873 | } | 2873 | } |
2874 | if (!(s = kmalloc(sizeof(struct es1371_state), GFP_KERNEL))) { | 2874 | if (!(s = kzalloc(sizeof(struct es1371_state), GFP_KERNEL))) { |
2875 | printk(KERN_WARNING PFX "out of memory\n"); | 2875 | printk(KERN_WARNING PFX "out of memory\n"); |
2876 | return -ENOMEM; | 2876 | return -ENOMEM; |
2877 | } | 2877 | } |
2878 | memset(s, 0, sizeof(struct es1371_state)); | ||
2879 | 2878 | ||
2880 | s->codec = ac97_alloc_codec(); | 2879 | s->codec = ac97_alloc_codec(); |
2881 | if(s->codec == NULL) | 2880 | if(s->codec == NULL) |
diff --git a/sound/oss/hal2.c b/sound/oss/hal2.c index 80a42773c648..a94b9df489dc 100644 --- a/sound/oss/hal2.c +++ b/sound/oss/hal2.c | |||
@@ -1435,10 +1435,9 @@ static int hal2_init_card(struct hal2_card **phal2, struct hpc3_regs *hpc3) | |||
1435 | int ret = 0; | 1435 | int ret = 0; |
1436 | struct hal2_card *hal2; | 1436 | struct hal2_card *hal2; |
1437 | 1437 | ||
1438 | hal2 = kmalloc(sizeof(struct hal2_card), GFP_KERNEL); | 1438 | hal2 = kzalloc(sizeof(struct hal2_card), GFP_KERNEL); |
1439 | if (!hal2) | 1439 | if (!hal2) |
1440 | return -ENOMEM; | 1440 | return -ENOMEM; |
1441 | memset(hal2, 0, sizeof(struct hal2_card)); | ||
1442 | 1441 | ||
1443 | hal2->ctl_regs = (struct hal2_ctl_regs *)hpc3->pbus_extregs[0]; | 1442 | hal2->ctl_regs = (struct hal2_ctl_regs *)hpc3->pbus_extregs[0]; |
1444 | hal2->aes_regs = (struct hal2_aes_regs *)hpc3->pbus_extregs[1]; | 1443 | hal2->aes_regs = (struct hal2_aes_regs *)hpc3->pbus_extregs[1]; |
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c index c3c8a720d555..f5e31f11973d 100644 --- a/sound/oss/i810_audio.c +++ b/sound/oss/i810_audio.c | |||
@@ -2580,10 +2580,9 @@ static int i810_open(struct inode *inode, struct file *file) | |||
2580 | for (i = 0; i < NR_HW_CH && card && !card->initializing; i++) { | 2580 | for (i = 0; i < NR_HW_CH && card && !card->initializing; i++) { |
2581 | if (card->states[i] == NULL) { | 2581 | if (card->states[i] == NULL) { |
2582 | state = card->states[i] = (struct i810_state *) | 2582 | state = card->states[i] = (struct i810_state *) |
2583 | kmalloc(sizeof(struct i810_state), GFP_KERNEL); | 2583 | kzalloc(sizeof(struct i810_state), GFP_KERNEL); |
2584 | if (state == NULL) | 2584 | if (state == NULL) |
2585 | return -ENOMEM; | 2585 | return -ENOMEM; |
2586 | memset(state, 0, sizeof(struct i810_state)); | ||
2587 | dmabuf = &state->dmabuf; | 2586 | dmabuf = &state->dmabuf; |
2588 | goto found_virt; | 2587 | goto found_virt; |
2589 | } | 2588 | } |
@@ -3205,10 +3204,9 @@ static void __devinit i810_configure_clocking (void) | |||
3205 | */ | 3204 | */ |
3206 | if(card != NULL) { | 3205 | if(card != NULL) { |
3207 | state = card->states[0] = (struct i810_state *) | 3206 | state = card->states[0] = (struct i810_state *) |
3208 | kmalloc(sizeof(struct i810_state), GFP_KERNEL); | 3207 | kzalloc(sizeof(struct i810_state), GFP_KERNEL); |
3209 | if (state == NULL) | 3208 | if (state == NULL) |
3210 | return; | 3209 | return; |
3211 | memset(state, 0, sizeof(struct i810_state)); | ||
3212 | dmabuf = &state->dmabuf; | 3210 | dmabuf = &state->dmabuf; |
3213 | 3211 | ||
3214 | dmabuf->write_channel = card->alloc_pcm_channel(card); | 3212 | dmabuf->write_channel = card->alloc_pcm_channel(card); |
@@ -3273,11 +3271,10 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device | |||
3273 | return -ENODEV; | 3271 | return -ENODEV; |
3274 | } | 3272 | } |
3275 | 3273 | ||
3276 | if ((card = kmalloc(sizeof(struct i810_card), GFP_KERNEL)) == NULL) { | 3274 | if ((card = kzalloc(sizeof(struct i810_card), GFP_KERNEL)) == NULL) { |
3277 | printk(KERN_ERR "i810_audio: out of memory\n"); | 3275 | printk(KERN_ERR "i810_audio: out of memory\n"); |
3278 | return -ENOMEM; | 3276 | return -ENOMEM; |
3279 | } | 3277 | } |
3280 | memset(card, 0, sizeof(*card)); | ||
3281 | 3278 | ||
3282 | card->initializing = 1; | 3279 | card->initializing = 1; |
3283 | card->pci_dev = pci_dev; | 3280 | card->pci_dev = pci_dev; |
diff --git a/sound/oss/kahlua.c b/sound/oss/kahlua.c index 12e7b3038be2..dfe670f12e67 100644 --- a/sound/oss/kahlua.c +++ b/sound/oss/kahlua.c | |||
@@ -139,13 +139,12 @@ static int __devinit probe_one(struct pci_dev *pdev, const struct pci_device_id | |||
139 | printk(KERN_INFO "kahlua: XpressAudio on IRQ %d, DMA %d, %d\n", | 139 | printk(KERN_INFO "kahlua: XpressAudio on IRQ %d, DMA %d, %d\n", |
140 | irq, dma8, dma16); | 140 | irq, dma8, dma16); |
141 | 141 | ||
142 | hw_config = kmalloc(sizeof(struct address_info), GFP_KERNEL); | 142 | hw_config = kzalloc(sizeof(struct address_info), GFP_KERNEL); |
143 | if(hw_config == NULL) | 143 | if(hw_config == NULL) |
144 | { | 144 | { |
145 | printk(KERN_ERR "kahlua: out of memory.\n"); | 145 | printk(KERN_ERR "kahlua: out of memory.\n"); |
146 | return 1; | 146 | return 1; |
147 | } | 147 | } |
148 | memset(hw_config, 0, sizeof(*hw_config)); | ||
149 | 148 | ||
150 | pci_set_drvdata(pdev, hw_config); | 149 | pci_set_drvdata(pdev, hw_config); |
151 | 150 | ||
diff --git a/sound/oss/nec_vrc5477.c b/sound/oss/nec_vrc5477.c index d459bdb14154..27b4ba3aaa7c 100644 --- a/sound/oss/nec_vrc5477.c +++ b/sound/oss/nec_vrc5477.c | |||
@@ -1860,11 +1860,10 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev, | |||
1860 | if (pcidev->irq == 0) | 1860 | if (pcidev->irq == 0) |
1861 | return -1; | 1861 | return -1; |
1862 | 1862 | ||
1863 | if (!(s = kmalloc(sizeof(struct vrc5477_ac97_state), GFP_KERNEL))) { | 1863 | if (!(s = kzalloc(sizeof(struct vrc5477_ac97_state), GFP_KERNEL))) { |
1864 | printk(KERN_ERR PFX "alloc of device struct failed\n"); | 1864 | printk(KERN_ERR PFX "alloc of device struct failed\n"); |
1865 | return -1; | 1865 | return -1; |
1866 | } | 1866 | } |
1867 | memset(s, 0, sizeof(struct vrc5477_ac97_state)); | ||
1868 | 1867 | ||
1869 | init_waitqueue_head(&s->dma_adc.wait); | 1868 | init_waitqueue_head(&s->dma_adc.wait); |
1870 | init_waitqueue_head(&s->dma_dac.wait); | 1869 | init_waitqueue_head(&s->dma_dac.wait); |
diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c index 2e8cfa5481f2..fc273e550944 100644 --- a/sound/oss/opl3.c +++ b/sound/oss/opl3.c | |||
@@ -166,7 +166,7 @@ int opl3_detect(int ioaddr, int *osp) | |||
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
169 | devc = kmalloc(sizeof(*devc), GFP_KERNEL); | 169 | devc = kzalloc(sizeof(*devc), GFP_KERNEL); |
170 | 170 | ||
171 | if (devc == NULL) | 171 | if (devc == NULL) |
172 | { | 172 | { |
@@ -175,7 +175,6 @@ int opl3_detect(int ioaddr, int *osp) | |||
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | 177 | ||
178 | memset(devc, 0, sizeof(*devc)); | ||
179 | strcpy(devc->fm_info.name, "OPL2"); | 178 | strcpy(devc->fm_info.name, "OPL2"); |
180 | 179 | ||
181 | if (!request_region(ioaddr, 4, devc->fm_info.name)) { | 180 | if (!request_region(ioaddr, 4, devc->fm_info.name)) { |
diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c index 8666291c0052..27acd6f29b98 100644 --- a/sound/oss/sb_card.c +++ b/sound/oss/sb_card.c | |||
@@ -137,11 +137,10 @@ static int __init sb_init_legacy(void) | |||
137 | { | 137 | { |
138 | struct sb_module_options sbmo = {0}; | 138 | struct sb_module_options sbmo = {0}; |
139 | 139 | ||
140 | if((legacy = kmalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) { | 140 | if((legacy = kzalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) { |
141 | printk(KERN_ERR "sb: Error: Could not allocate memory\n"); | 141 | printk(KERN_ERR "sb: Error: Could not allocate memory\n"); |
142 | return -ENOMEM; | 142 | return -ENOMEM; |
143 | } | 143 | } |
144 | memset(legacy, 0, sizeof(struct sb_card_config)); | ||
145 | 144 | ||
146 | legacy->conf.io_base = io; | 145 | legacy->conf.io_base = io; |
147 | legacy->conf.irq = irq; | 146 | legacy->conf.irq = irq; |
@@ -247,11 +246,10 @@ static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device | |||
247 | return -EBUSY; | 246 | return -EBUSY; |
248 | } | 247 | } |
249 | 248 | ||
250 | if((scc = kmalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) { | 249 | if((scc = kzalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) { |
251 | printk(KERN_ERR "sb: Error: Could not allocate memory\n"); | 250 | printk(KERN_ERR "sb: Error: Could not allocate memory\n"); |
252 | return -ENOMEM; | 251 | return -ENOMEM; |
253 | } | 252 | } |
254 | memset(scc, 0, sizeof(struct sb_card_config)); | ||
255 | 253 | ||
256 | printk(KERN_INFO "sb: PnP: Found Card Named = \"%s\", Card PnP id = " \ | 254 | printk(KERN_INFO "sb: PnP: Found Card Named = \"%s\", Card PnP id = " \ |
257 | "%s, Device PnP id = %s\n", card->card->name, card_id->id, | 255 | "%s, Device PnP id = %s\n", card->card->name, card_id->id, |
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 9f7e5f59ac82..016b918329ad 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -616,25 +616,23 @@ static int init_serdma(serdma_t *dma) | |||
616 | 616 | ||
617 | /* Descriptors */ | 617 | /* Descriptors */ |
618 | dma->ringsz = DMA_DESCR; | 618 | dma->ringsz = DMA_DESCR; |
619 | dma->descrtab = kmalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL); | 619 | dma->descrtab = kzalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL); |
620 | if (!dma->descrtab) { | 620 | if (!dma->descrtab) { |
621 | printk(KERN_ERR "cs4297a: kmalloc descrtab failed\n"); | 621 | printk(KERN_ERR "cs4297a: kzalloc descrtab failed\n"); |
622 | return -1; | 622 | return -1; |
623 | } | 623 | } |
624 | memset(dma->descrtab, 0, dma->ringsz * sizeof(serdma_descr_t)); | ||
625 | dma->descrtab_end = dma->descrtab + dma->ringsz; | 624 | dma->descrtab_end = dma->descrtab + dma->ringsz; |
626 | /* XXX bloddy mess, use proper DMA API here ... */ | 625 | /* XXX bloddy mess, use proper DMA API here ... */ |
627 | dma->descrtab_phys = CPHYSADDR((long)dma->descrtab); | 626 | dma->descrtab_phys = CPHYSADDR((long)dma->descrtab); |
628 | dma->descr_add = dma->descr_rem = dma->descrtab; | 627 | dma->descr_add = dma->descr_rem = dma->descrtab; |
629 | 628 | ||
630 | /* Frame buffer area */ | 629 | /* Frame buffer area */ |
631 | dma->dma_buf = kmalloc(DMA_BUF_SIZE, GFP_KERNEL); | 630 | dma->dma_buf = kzalloc(DMA_BUF_SIZE, GFP_KERNEL); |
632 | if (!dma->dma_buf) { | 631 | if (!dma->dma_buf) { |
633 | printk(KERN_ERR "cs4297a: kmalloc dma_buf failed\n"); | 632 | printk(KERN_ERR "cs4297a: kzalloc dma_buf failed\n"); |
634 | kfree(dma->descrtab); | 633 | kfree(dma->descrtab); |
635 | return -1; | 634 | return -1; |
636 | } | 635 | } |
637 | memset(dma->dma_buf, 0, DMA_BUF_SIZE); | ||
638 | dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf); | 636 | dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf); |
639 | 637 | ||
640 | /* Samples buffer area */ | 638 | /* Samples buffer area */ |
@@ -2619,12 +2617,11 @@ static int __init cs4297a_init(void) | |||
2619 | udelay(100); | 2617 | udelay(100); |
2620 | #endif | 2618 | #endif |
2621 | 2619 | ||
2622 | if (!(s = kmalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) { | 2620 | if (!(s = kzalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) { |
2623 | CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR | 2621 | CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR |
2624 | "cs4297a: probe() no memory for state struct.\n")); | 2622 | "cs4297a: probe() no memory for state struct.\n")); |
2625 | return -1; | 2623 | return -1; |
2626 | } | 2624 | } |
2627 | memset(s, 0, sizeof(struct cs4297a_state)); | ||
2628 | s->magic = CS4297a_MAGIC; | 2625 | s->magic = CS4297a_MAGIC; |
2629 | init_waitqueue_head(&s->dma_adc.wait); | 2626 | init_waitqueue_head(&s->dma_adc.wait); |
2630 | init_waitqueue_head(&s->dma_dac.wait); | 2627 | init_waitqueue_head(&s->dma_dac.wait); |
diff --git a/sound/oss/trident.c b/sound/oss/trident.c index 6b1f8c9cdcf8..72a8a0ed36a2 100644 --- a/sound/oss/trident.c +++ b/sound/oss/trident.c | |||
@@ -2729,12 +2729,11 @@ trident_open(struct inode *inode, struct file *file) | |||
2729 | } | 2729 | } |
2730 | for (i = 0; i < NR_HW_CH; i++) { | 2730 | for (i = 0; i < NR_HW_CH; i++) { |
2731 | if (card->states[i] == NULL) { | 2731 | if (card->states[i] == NULL) { |
2732 | state = card->states[i] = kmalloc(sizeof(*state), GFP_KERNEL); | 2732 | state = card->states[i] = kzalloc(sizeof(*state), GFP_KERNEL); |
2733 | if (state == NULL) { | 2733 | if (state == NULL) { |
2734 | mutex_unlock(&card->open_mutex); | 2734 | mutex_unlock(&card->open_mutex); |
2735 | return -ENOMEM; | 2735 | return -ENOMEM; |
2736 | } | 2736 | } |
2737 | memset(state, 0, sizeof(*state)); | ||
2738 | mutex_init(&state->sem); | 2737 | mutex_init(&state->sem); |
2739 | dmabuf = &state->dmabuf; | 2738 | dmabuf = &state->dmabuf; |
2740 | goto found_virt; | 2739 | goto found_virt; |
@@ -3618,7 +3617,7 @@ ali_allocate_other_states_resources(struct trident_state *state, int chan_nums) | |||
3618 | } | 3617 | } |
3619 | return -EBUSY; | 3618 | return -EBUSY; |
3620 | } | 3619 | } |
3621 | s = card->states[i] = kmalloc(sizeof(*state), GFP_KERNEL); | 3620 | s = card->states[i] = kzalloc(sizeof(*state), GFP_KERNEL); |
3622 | if (!s) { | 3621 | if (!s) { |
3623 | num = ali_multi_channels_5_1[state_count]; | 3622 | num = ali_multi_channels_5_1[state_count]; |
3624 | ali_free_pcm_channel(card, num); | 3623 | ali_free_pcm_channel(card, num); |
@@ -3630,7 +3629,6 @@ ali_allocate_other_states_resources(struct trident_state *state, int chan_nums) | |||
3630 | } | 3629 | } |
3631 | return -ENOMEM; | 3630 | return -ENOMEM; |
3632 | } | 3631 | } |
3633 | memset(s, 0, sizeof(*state)); | ||
3634 | 3632 | ||
3635 | s->dmabuf.channel = channel; | 3633 | s->dmabuf.channel = channel; |
3636 | s->dmabuf.ossfragshift = s->dmabuf.ossmaxfrags = | 3634 | s->dmabuf.ossfragshift = s->dmabuf.ossmaxfrags = |
@@ -4399,11 +4397,10 @@ trident_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id) | |||
4399 | } | 4397 | } |
4400 | 4398 | ||
4401 | rc = -ENOMEM; | 4399 | rc = -ENOMEM; |
4402 | if ((card = kmalloc(sizeof(*card), GFP_KERNEL)) == NULL) { | 4400 | if ((card = kzalloc(sizeof(*card), GFP_KERNEL)) == NULL) { |
4403 | printk(KERN_ERR "trident: out of memory\n"); | 4401 | printk(KERN_ERR "trident: out of memory\n"); |
4404 | goto out_release_region; | 4402 | goto out_release_region; |
4405 | } | 4403 | } |
4406 | memset(card, 0, sizeof (*card)); | ||
4407 | 4404 | ||
4408 | init_timer(&card->timer); | 4405 | init_timer(&card->timer); |
4409 | card->iobase = iobase; | 4406 | card->iobase = iobase; |
diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index 26a7c6af95bc..b48c72923a13 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c | |||
@@ -1267,12 +1267,10 @@ static int __init waveartist_init(wavnc_info *devc) | |||
1267 | conf_printf2(dev_name, devc->hw.io_base, devc->hw.irq, | 1267 | conf_printf2(dev_name, devc->hw.io_base, devc->hw.irq, |
1268 | devc->hw.dma, devc->hw.dma2); | 1268 | devc->hw.dma, devc->hw.dma2); |
1269 | 1269 | ||
1270 | portc = kmalloc(sizeof(wavnc_port_info), GFP_KERNEL); | 1270 | portc = kzalloc(sizeof(wavnc_port_info), GFP_KERNEL); |
1271 | if (portc == NULL) | 1271 | if (portc == NULL) |
1272 | goto nomem; | 1272 | goto nomem; |
1273 | 1273 | ||
1274 | memset(portc, 0, sizeof(wavnc_port_info)); | ||
1275 | |||
1276 | my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION, dev_name, | 1274 | my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION, dev_name, |
1277 | &waveartist_audio_driver, sizeof(struct audio_driver), | 1275 | &waveartist_audio_driver, sizeof(struct audio_driver), |
1278 | devc->audio_flags, AFMT_U8 | AFMT_S16_LE | AFMT_S8, | 1276 | devc->audio_flags, AFMT_U8 | AFMT_S16_LE | AFMT_S8, |