aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPanagiotis Issaris <takis@issaris.org>2006-07-25 09:28:03 -0400
committerJaroslav Kysela <perex@suse.cz>2006-08-03 09:21:18 -0400
commit59feddb25f9d925e86ee22596802405788bc050f (patch)
tree0d272bdcb64cf2bcc19adf8735215ce261aea355 /sound
parentfb6a0d635d4ff6b3555179d0154981f03427071a (diff)
[ALSA] Conversions from kmalloc+memset to k(z|c)alloc
sound: Conversions from kmalloc+memset to k(c|z)alloc. Signed-off-by: Panagiotis Issaris <takis@issaris.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/oss/mixer_oss.c3
-rw-r--r--sound/core/seq/seq_device.c3
-rw-r--r--sound/core/sgbuf.c9
-rw-r--r--sound/drivers/vx/vx_pcm.c7
-rw-r--r--sound/pci/echoaudio/echoaudio.c4
-rw-r--r--sound/ppc/awacs.c3
-rw-r--r--sound/ppc/daca.c3
-rw-r--r--sound/ppc/keywest.c3
-rw-r--r--sound/ppc/tumbler.c3
-rw-r--r--sound/usb/usbaudio.c6
10 files changed, 15 insertions, 29 deletions
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 71b5080fa66d..75a9505c7445 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -988,13 +988,12 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix
988 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) { 988 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) {
989 struct snd_ctl_elem_info *uinfo; 989 struct snd_ctl_elem_info *uinfo;
990 990
991 uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL); 991 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
992 if (! uinfo) { 992 if (! uinfo) {
993 up_read(&mixer->card->controls_rwsem); 993 up_read(&mixer->card->controls_rwsem);
994 return -ENOMEM; 994 return -ENOMEM;
995 } 995 }
996 996
997 memset(uinfo, 0, sizeof(*uinfo));
998 if (kctl->info(kctl, uinfo)) { 997 if (kctl->info(kctl, uinfo)) {
999 up_read(&mixer->card->controls_rwsem); 998 up_read(&mixer->card->controls_rwsem);
1000 return 0; 999 return 0;
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 4260de90f36f..102ff548ce69 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -372,10 +372,9 @@ static struct ops_list * create_driver(char *id)
372{ 372{
373 struct ops_list *ops; 373 struct ops_list *ops;
374 374
375 ops = kmalloc(sizeof(*ops), GFP_KERNEL); 375 ops = kzalloc(sizeof(*ops), GFP_KERNEL);
376 if (ops == NULL) 376 if (ops == NULL)
377 return ops; 377 return ops;
378 memset(ops, 0, sizeof(*ops));
379 378
380 /* set up driver entry */ 379 /* set up driver entry */
381 strlcpy(ops->id, id, sizeof(ops->id)); 380 strlcpy(ops->id, id, sizeof(ops->id));
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index 6e4d4ab34632..c30669f14ac0 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -68,21 +68,18 @@ void *snd_malloc_sgbuf_pages(struct device *device,
68 68
69 dmab->area = NULL; 69 dmab->area = NULL;
70 dmab->addr = 0; 70 dmab->addr = 0;
71 dmab->private_data = sgbuf = kmalloc(sizeof(*sgbuf), GFP_KERNEL); 71 dmab->private_data = sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL);
72 if (! sgbuf) 72 if (! sgbuf)
73 return NULL; 73 return NULL;
74 memset(sgbuf, 0, sizeof(*sgbuf));
75 sgbuf->dev = device; 74 sgbuf->dev = device;
76 pages = snd_sgbuf_aligned_pages(size); 75 pages = snd_sgbuf_aligned_pages(size);
77 sgbuf->tblsize = sgbuf_align_table(pages); 76 sgbuf->tblsize = sgbuf_align_table(pages);
78 sgbuf->table = kmalloc(sizeof(*sgbuf->table) * sgbuf->tblsize, GFP_KERNEL); 77 sgbuf->table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->table), GFP_KERNEL);
79 if (! sgbuf->table) 78 if (! sgbuf->table)
80 goto _failed; 79 goto _failed;
81 memset(sgbuf->table, 0, sizeof(*sgbuf->table) * sgbuf->tblsize); 80 sgbuf->page_table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->page_table), GFP_KERNEL);
82 sgbuf->page_table = kmalloc(sizeof(*sgbuf->page_table) * sgbuf->tblsize, GFP_KERNEL);
83 if (! sgbuf->page_table) 81 if (! sgbuf->page_table)
84 goto _failed; 82 goto _failed;
85 memset(sgbuf->page_table, 0, sizeof(*sgbuf->page_table) * sgbuf->tblsize);
86 83
87 /* allocate each page */ 84 /* allocate each page */
88 for (i = 0; i < pages; i++) { 85 for (i = 0; i < pages; i++) {
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index c4af84995d05..7e65a103fbb2 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1252,18 +1252,15 @@ static int vx_init_audio_io(struct vx_core *chip)
1252 chip->audio_info = rmh.Stat[1]; 1252 chip->audio_info = rmh.Stat[1];
1253 1253
1254 /* allocate pipes */ 1254 /* allocate pipes */
1255 chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL); 1255 chip->playback_pipes = kcalloc(chip->audio_outs, sizeof(struct vx_pipe *), GFP_KERNEL);
1256 if (!chip->playback_pipes) 1256 if (!chip->playback_pipes)
1257 return -ENOMEM; 1257 return -ENOMEM;
1258 chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL); 1258 chip->capture_pipes = kcalloc(chip->audio_ins, sizeof(struct vx_pipe *), GFP_KERNEL);
1259 if (!chip->capture_pipes) { 1259 if (!chip->capture_pipes) {
1260 kfree(chip->playback_pipes); 1260 kfree(chip->playback_pipes);
1261 return -ENOMEM; 1261 return -ENOMEM;
1262 } 1262 }
1263 1263
1264 memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs);
1265 memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins);
1266
1267 preferred = chip->ibl.size; 1264 preferred = chip->ibl.size;
1268 chip->ibl.size = 0; 1265 chip->ibl.size = 0;
1269 vx_set_ibl(chip, &chip->ibl); /* query the info */ 1266 vx_set_ibl(chip, &chip->ibl); /* query the info */
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 27a8dbe6f6a8..c3dafa29054f 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -236,9 +236,9 @@ static int pcm_open(struct snd_pcm_substream *substream,
236 chip = snd_pcm_substream_chip(substream); 236 chip = snd_pcm_substream_chip(substream);
237 runtime = substream->runtime; 237 runtime = substream->runtime;
238 238
239 if (!(pipe = kmalloc(sizeof(struct audiopipe), GFP_KERNEL))) 239 pipe = kzalloc(sizeof(struct audiopipe), GFP_KERNEL);
240 if (!pipe)
240 return -ENOMEM; 241 return -ENOMEM;
241 memset(pipe, 0, sizeof(struct audiopipe));
242 pipe->index = -1; /* Not configured yet */ 242 pipe->index = -1; /* Not configured yet */
243 243
244 /* Set up hw capabilities and contraints */ 244 /* Set up hw capabilities and contraints */
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 82d791be7499..05dabe454658 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -801,11 +801,10 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
801 chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; 801 chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf;
802#ifdef PMAC_AMP_AVAIL 802#ifdef PMAC_AMP_AVAIL
803 if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) { 803 if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) {
804 struct awacs_amp *amp = kmalloc(sizeof(*amp), GFP_KERNEL); 804 struct awacs_amp *amp = kzalloc(sizeof(*amp), GFP_KERNEL);
805 if (! amp) 805 if (! amp)
806 return -ENOMEM; 806 return -ENOMEM;
807 chip->mixer_data = amp; 807 chip->mixer_data = amp;
808 memset(amp, 0, sizeof(*amp));
809 chip->mixer_free = awacs_amp_free; 808 chip->mixer_free = awacs_amp_free;
810 awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */ 809 awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */
811 awacs_amp_set_vol(amp, 1, 63, 63, 0); 810 awacs_amp_set_vol(amp, 1, 63, 63, 0);
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c
index 46eebf5610e3..57202b0f033e 100644
--- a/sound/ppc/daca.c
+++ b/sound/ppc/daca.c
@@ -258,10 +258,9 @@ int __init snd_pmac_daca_init(struct snd_pmac *chip)
258 request_module("i2c-powermac"); 258 request_module("i2c-powermac");
259#endif /* CONFIG_KMOD */ 259#endif /* CONFIG_KMOD */
260 260
261 mix = kmalloc(sizeof(*mix), GFP_KERNEL); 261 mix = kzalloc(sizeof(*mix), GFP_KERNEL);
262 if (! mix) 262 if (! mix)
263 return -ENOMEM; 263 return -ENOMEM;
264 memset(mix, 0, sizeof(*mix));
265 chip->mixer_data = mix; 264 chip->mixer_data = mix;
266 chip->mixer_free = daca_cleanup; 265 chip->mixer_free = daca_cleanup;
267 mix->amp_on = 1; /* default on */ 266 mix->amp_on = 1; /* default on */
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c
index fb05938dcbd9..59482a4cd446 100644
--- a/sound/ppc/keywest.c
+++ b/sound/ppc/keywest.c
@@ -64,11 +64,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter)
64 if (strncmp(i2c_device_name(adapter), "mac-io", 6)) 64 if (strncmp(i2c_device_name(adapter), "mac-io", 6))
65 return 0; /* ignored */ 65 return 0; /* ignored */
66 66
67 new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 67 new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
68 if (! new_client) 68 if (! new_client)
69 return -ENOMEM; 69 return -ENOMEM;
70 70
71 memset(new_client, 0, sizeof(*new_client));
72 new_client->addr = keywest_ctx->addr; 71 new_client->addr = keywest_ctx->addr;
73 i2c_set_clientdata(new_client, keywest_ctx); 72 i2c_set_clientdata(new_client, keywest_ctx);
74 new_client->adapter = adapter; 73 new_client->adapter = adapter;
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 692c61177678..84f6b19c07ca 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -1316,10 +1316,9 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
1316 request_module("i2c-powermac"); 1316 request_module("i2c-powermac");
1317#endif /* CONFIG_KMOD */ 1317#endif /* CONFIG_KMOD */
1318 1318
1319 mix = kmalloc(sizeof(*mix), GFP_KERNEL); 1319 mix = kzalloc(sizeof(*mix), GFP_KERNEL);
1320 if (! mix) 1320 if (! mix)
1321 return -ENOMEM; 1321 return -ENOMEM;
1322 memset(mix, 0, sizeof(*mix));
1323 mix->headphone_irq = -1; 1322 mix->headphone_irq = -1;
1324 1323
1325 chip->mixer_data = mix; 1324 chip->mixer_data = mix;
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index d32d83d970cc..1b7f499c549d 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2260,10 +2260,9 @@ static int add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct aud
2260 } 2260 }
2261 2261
2262 /* create a new pcm */ 2262 /* create a new pcm */
2263 as = kmalloc(sizeof(*as), GFP_KERNEL); 2263 as = kzalloc(sizeof(*as), GFP_KERNEL);
2264 if (! as) 2264 if (! as)
2265 return -ENOMEM; 2265 return -ENOMEM;
2266 memset(as, 0, sizeof(*as));
2267 as->pcm_index = chip->pcm_devs; 2266 as->pcm_index = chip->pcm_devs;
2268 as->chip = chip; 2267 as->chip = chip;
2269 as->fmt_type = fp->fmt_type; 2268 as->fmt_type = fp->fmt_type;
@@ -2633,13 +2632,12 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
2633 csep = NULL; 2632 csep = NULL;
2634 } 2633 }
2635 2634
2636 fp = kmalloc(sizeof(*fp), GFP_KERNEL); 2635 fp = kzalloc(sizeof(*fp), GFP_KERNEL);
2637 if (! fp) { 2636 if (! fp) {
2638 snd_printk(KERN_ERR "cannot malloc\n"); 2637 snd_printk(KERN_ERR "cannot malloc\n");
2639 return -ENOMEM; 2638 return -ENOMEM;
2640 } 2639 }
2641 2640
2642 memset(fp, 0, sizeof(*fp));
2643 fp->iface = iface_no; 2641 fp->iface = iface_no;
2644 fp->altsetting = altno; 2642 fp->altsetting = altno;
2645 fp->altset_idx = i; 2643 fp->altset_idx = i;