[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>

authored by Panagiotis Issaris and committed by Jaroslav Kysela 59feddb2 fb6a0d63

+15 -29
+1 -2
sound/core/oss/mixer_oss.c
··· 988 988 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) { 989 989 struct snd_ctl_elem_info *uinfo; 990 990 991 - uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL); 991 + uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); 992 992 if (! uinfo) { 993 993 up_read(&mixer->card->controls_rwsem); 994 994 return -ENOMEM; 995 995 } 996 996 997 - memset(uinfo, 0, sizeof(*uinfo)); 998 997 if (kctl->info(kctl, uinfo)) { 999 998 up_read(&mixer->card->controls_rwsem); 1000 999 return 0;
+1 -2
sound/core/seq/seq_device.c
··· 372 372 { 373 373 struct ops_list *ops; 374 374 375 - ops = kmalloc(sizeof(*ops), GFP_KERNEL); 375 + ops = kzalloc(sizeof(*ops), GFP_KERNEL); 376 376 if (ops == NULL) 377 377 return ops; 378 - memset(ops, 0, sizeof(*ops)); 379 378 380 379 /* set up driver entry */ 381 380 strlcpy(ops->id, id, sizeof(ops->id));
+3 -6
sound/core/sgbuf.c
··· 68 68 69 69 dmab->area = NULL; 70 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 72 if (! sgbuf) 73 73 return NULL; 74 - memset(sgbuf, 0, sizeof(*sgbuf)); 75 74 sgbuf->dev = device; 76 75 pages = snd_sgbuf_aligned_pages(size); 77 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 78 if (! sgbuf->table) 80 79 goto _failed; 81 - memset(sgbuf->table, 0, sizeof(*sgbuf->table) * sgbuf->tblsize); 82 - sgbuf->page_table = kmalloc(sizeof(*sgbuf->page_table) * sgbuf->tblsize, GFP_KERNEL); 80 + sgbuf->page_table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->page_table), GFP_KERNEL); 83 81 if (! sgbuf->page_table) 84 82 goto _failed; 85 - memset(sgbuf->page_table, 0, sizeof(*sgbuf->page_table) * sgbuf->tblsize); 86 83 87 84 /* allocate each page */ 88 85 for (i = 0; i < pages; i++) {
+2 -5
sound/drivers/vx/vx_pcm.c
··· 1252 1252 chip->audio_info = rmh.Stat[1]; 1253 1253 1254 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 1256 if (!chip->playback_pipes) 1257 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 1259 if (!chip->capture_pipes) { 1260 1260 kfree(chip->playback_pipes); 1261 1261 return -ENOMEM; 1262 1262 } 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 1263 1267 1264 preferred = chip->ibl.size; 1268 1265 chip->ibl.size = 0;
+2 -2
sound/pci/echoaudio/echoaudio.c
··· 236 236 chip = snd_pcm_substream_chip(substream); 237 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 241 return -ENOMEM; 241 - memset(pipe, 0, sizeof(struct audiopipe)); 242 242 pipe->index = -1; /* Not configured yet */ 243 243 244 244 /* Set up hw capabilities and contraints */
+1 -2
sound/ppc/awacs.c
··· 801 801 chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; 802 802 #ifdef PMAC_AMP_AVAIL 803 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 805 if (! amp) 806 806 return -ENOMEM; 807 807 chip->mixer_data = amp; 808 - memset(amp, 0, sizeof(*amp)); 809 808 chip->mixer_free = awacs_amp_free; 810 809 awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */ 811 810 awacs_amp_set_vol(amp, 1, 63, 63, 0);
+1 -2
sound/ppc/daca.c
··· 258 258 request_module("i2c-powermac"); 259 259 #endif /* CONFIG_KMOD */ 260 260 261 - mix = kmalloc(sizeof(*mix), GFP_KERNEL); 261 + mix = kzalloc(sizeof(*mix), GFP_KERNEL); 262 262 if (! mix) 263 263 return -ENOMEM; 264 - memset(mix, 0, sizeof(*mix)); 265 264 chip->mixer_data = mix; 266 265 chip->mixer_free = daca_cleanup; 267 266 mix->amp_on = 1; /* default on */
+1 -2
sound/ppc/keywest.c
··· 64 64 if (strncmp(i2c_device_name(adapter), "mac-io", 6)) 65 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 68 if (! new_client) 69 69 return -ENOMEM; 70 70 71 - memset(new_client, 0, sizeof(*new_client)); 72 71 new_client->addr = keywest_ctx->addr; 73 72 i2c_set_clientdata(new_client, keywest_ctx); 74 73 new_client->adapter = adapter;
+1 -2
sound/ppc/tumbler.c
··· 1316 1316 request_module("i2c-powermac"); 1317 1317 #endif /* CONFIG_KMOD */ 1318 1318 1319 - mix = kmalloc(sizeof(*mix), GFP_KERNEL); 1319 + mix = kzalloc(sizeof(*mix), GFP_KERNEL); 1320 1320 if (! mix) 1321 1321 return -ENOMEM; 1322 - memset(mix, 0, sizeof(*mix)); 1323 1322 mix->headphone_irq = -1; 1324 1323 1325 1324 chip->mixer_data = mix;
+2 -4
sound/usb/usbaudio.c
··· 2260 2260 } 2261 2261 2262 2262 /* create a new pcm */ 2263 - as = kmalloc(sizeof(*as), GFP_KERNEL); 2263 + as = kzalloc(sizeof(*as), GFP_KERNEL); 2264 2264 if (! as) 2265 2265 return -ENOMEM; 2266 - memset(as, 0, sizeof(*as)); 2267 2266 as->pcm_index = chip->pcm_devs; 2268 2267 as->chip = chip; 2269 2268 as->fmt_type = fp->fmt_type; ··· 2632 2633 csep = NULL; 2633 2634 } 2634 2635 2635 - fp = kmalloc(sizeof(*fp), GFP_KERNEL); 2636 + fp = kzalloc(sizeof(*fp), GFP_KERNEL); 2636 2637 if (! fp) { 2637 2638 snd_printk(KERN_ERR "cannot malloc\n"); 2638 2639 return -ENOMEM; 2639 2640 } 2640 2641 2641 - memset(fp, 0, sizeof(*fp)); 2642 2642 fp->iface = iface_no; 2643 2643 fp->altsetting = altno; 2644 2644 fp->altset_idx = i;