Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ALSA] Replace with kzalloc() - others

Documentation,SA11xx UDA1341 driver,Generic drivers,MPU401 UART,OPL3
OPL4,Digigram VX core,I2C cs8427,I2C lib core,I2C tea6330t,L3 drivers
AK4114 receiver,AK4117 receiver,PDAudioCF driver,PPC PMAC driver
SPARC AMD7930 driver,SPARC cs4231 driver,Synth,Common EMU synth
USB generic driver,USB USX2Y
Replace kcalloc(1,..) with kzalloc().

Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Takashi Iwai and committed by
Jaroslav Kysela
561b220a e560d8d8

+48 -48
+5 -5
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
··· 447 447 .... 448 448 449 449 /* allocate a chip-specific data with zero filled */ 450 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 450 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 451 451 if (chip == NULL) 452 452 return -ENOMEM; 453 453 ··· 949 949 After allocating a card instance via 950 950 <function>snd_card_new()</function> (with 951 951 <constant>NULL</constant> on the 4th arg), call 952 - <function>kcalloc()</function>. 952 + <function>kzalloc()</function>. 953 953 954 954 <informalexample> 955 955 <programlisting> ··· 958 958 mychip_t *chip; 959 959 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); 960 960 ..... 961 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 961 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 962 962 ]]> 963 963 </programlisting> 964 964 </informalexample> ··· 1136 1136 return -ENXIO; 1137 1137 } 1138 1138 1139 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1139 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 1140 1140 if (chip == NULL) { 1141 1141 pci_disable_device(pci); 1142 1142 return -ENOMEM; ··· 1292 1292 need to initialize this number as -1 before actual allocation, 1293 1293 since irq 0 is valid. The port address and its resource pointer 1294 1294 can be initialized as null by 1295 - <function>kcalloc()</function> automatically, so you 1295 + <function>kzalloc()</function> automatically, so you 1296 1296 don't have to take care of resetting them. 1297 1297 </para> 1298 1298
+2 -2
sound/arm/sa11xx-uda1341.c
··· 21 21 * merged HAL layer (patches from Brian) 22 22 */ 23 23 24 - /* $Id: sa11xx-uda1341.c,v 1.22 2005/09/05 16:17:58 tiwai Exp $ */ 24 + /* $Id: sa11xx-uda1341.c,v 1.23 2005/09/09 13:22:34 tiwai Exp $ */ 25 25 26 26 /*************************************************************************************************** 27 27 * ··· 918 918 if (card == NULL) 919 919 return -ENOMEM; 920 920 921 - sa11xx_uda1341 = kcalloc(1, sizeof(*sa11xx_uda1341), GFP_KERNEL); 921 + sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL); 922 922 if (sa11xx_uda1341 == NULL) 923 923 return -ENOMEM; 924 924 spin_lock_init(&chip->s[0].dma_lock);
+2 -2
sound/drivers/dummy.c
··· 337 337 snd_card_dummy_pcm_t *dpcm; 338 338 int err; 339 339 340 - dpcm = kcalloc(1, sizeof(*dpcm), GFP_KERNEL); 340 + dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); 341 341 if (dpcm == NULL) 342 342 return -ENOMEM; 343 343 init_timer(&dpcm->timer); ··· 368 368 snd_card_dummy_pcm_t *dpcm; 369 369 int err; 370 370 371 - dpcm = kcalloc(1, sizeof(*dpcm), GFP_KERNEL); 371 + dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); 372 372 if (dpcm == NULL) 373 373 return -ENOMEM; 374 374 init_timer(&dpcm->timer);
+1 -1
sound/drivers/mpu401/mpu401_uart.c
··· 463 463 *rrawmidi = NULL; 464 464 if ((err = snd_rawmidi_new(card, "MPU-401U", device, 1, 1, &rmidi)) < 0) 465 465 return err; 466 - mpu = kcalloc(1, sizeof(*mpu), GFP_KERNEL); 466 + mpu = kzalloc(sizeof(*mpu), GFP_KERNEL); 467 467 if (mpu == NULL) { 468 468 snd_device_free(card, rmidi); 469 469 return -ENOMEM;
+1 -1
sound/drivers/mtpav.c
··· 688 688 689 689 static mtpav_t *new_mtpav(void) 690 690 { 691 - mtpav_t *ncrd = kcalloc(1, sizeof(*ncrd), GFP_KERNEL); 691 + mtpav_t *ncrd = kzalloc(sizeof(*ncrd), GFP_KERNEL); 692 692 if (ncrd != NULL) { 693 693 spin_lock_init(&ncrd->spinlock); 694 694
+1 -1
sound/drivers/opl3/opl3_lib.c
··· 354 354 int err; 355 355 356 356 *ropl3 = NULL; 357 - opl3 = kcalloc(1, sizeof(*opl3), GFP_KERNEL); 357 + opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL); 358 358 if (opl3 == NULL) 359 359 return -ENOMEM; 360 360
+1 -1
sound/drivers/opl3/opl3_oss.c
··· 241 241 } 242 242 243 243 size = sizeof(*put) + sizeof(fm_xinstrument_t); 244 - put = kcalloc(1, size, GFP_KERNEL); 244 + put = kzalloc(size, GFP_KERNEL); 245 245 if (put == NULL) 246 246 return -ENOMEM; 247 247 /* build header */
+1 -1
sound/drivers/opl4/opl4_lib.c
··· 204 204 if (ropl4) 205 205 *ropl4 = NULL; 206 206 207 - opl4 = kcalloc(1, sizeof(*opl4), GFP_KERNEL); 207 + opl4 = kzalloc(sizeof(*opl4), GFP_KERNEL); 208 208 if (!opl4) 209 209 return -ENOMEM; 210 210
+1 -1
sound/drivers/serial-u16550.c
··· 779 779 int err; 780 780 781 781 782 - if ((uart = kcalloc(1, sizeof(*uart), GFP_KERNEL)) == NULL) 782 + if ((uart = kzalloc(sizeof(*uart), GFP_KERNEL)) == NULL) 783 783 return -ENOMEM; 784 784 uart->adaptor = adaptor; 785 785 uart->card = card;
+1 -1
sound/drivers/vx/vx_core.c
··· 782 782 783 783 snd_assert(card && hw && ops, return NULL); 784 784 785 - chip = kcalloc(1, sizeof(*chip) + extra_size, GFP_KERNEL); 785 + chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL); 786 786 if (! chip) { 787 787 snd_printk(KERN_ERR "vx_core: no memory\n"); 788 788 return NULL;
+1 -1
sound/drivers/vx/vx_pcm.c
··· 473 473 return err; 474 474 475 475 /* initialize the pipe record */ 476 - pipe = kcalloc(1, sizeof(*pipe), GFP_KERNEL); 476 + pipe = kzalloc(sizeof(*pipe), GFP_KERNEL); 477 477 if (! pipe) { 478 478 /* release the pipe */ 479 479 vx_init_rmh(&rmh, CMD_FREE_PIPE);
+1 -1
sound/i2c/cs8427.c
··· 200 200 201 201 if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), &device)) < 0) 202 202 return err; 203 - chip = device->private_data = kcalloc(1, sizeof(*chip), GFP_KERNEL); 203 + chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL); 204 204 if (chip == NULL) { 205 205 snd_i2c_device_free(device); 206 206 return -ENOMEM;
+2 -2
sound/i2c/i2c.c
··· 81 81 }; 82 82 83 83 *ri2c = NULL; 84 - bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); 84 + bus = kzalloc(sizeof(*bus), GFP_KERNEL); 85 85 if (bus == NULL) 86 86 return -ENOMEM; 87 87 init_MUTEX(&bus->lock_mutex); ··· 108 108 109 109 *rdevice = NULL; 110 110 snd_assert(bus != NULL, return -EINVAL); 111 - device = kcalloc(1, sizeof(*device), GFP_KERNEL); 111 + device = kzalloc(sizeof(*device), GFP_KERNEL); 112 112 if (device == NULL) 113 113 return -ENOMEM; 114 114 device->addr = addr;
+3 -3
sound/i2c/l3/uda1341.c
··· 17 17 * 2002-05-12 Tomas Kasparek another code cleanup 18 18 */ 19 19 20 - /* $Id: uda1341.c,v 1.15 2005/01/03 12:05:20 tiwai Exp $ */ 20 + /* $Id: uda1341.c,v 1.16 2005/09/09 13:22:34 tiwai Exp $ */ 21 21 22 22 #include <sound/driver.h> 23 23 #include <linux/module.h> ··· 670 670 671 671 snd_assert(card != NULL, return -EINVAL); 672 672 673 - uda1341 = kcalloc(1, sizeof(*uda1341), GFP_KERNEL); 673 + uda1341 = kzalloc(sizeof(*uda1341), GFP_KERNEL); 674 674 if (uda1341 == NULL) 675 675 return -ENOMEM; 676 676 ··· 707 707 { 708 708 struct uda1341 *uda; 709 709 710 - uda = kcalloc(1, sizeof(*uda), 0, GFP_KERNEL); 710 + uda = kzalloc(sizeof(*uda), 0, GFP_KERNEL); 711 711 if (!uda) 712 712 return -ENOMEM; 713 713
+1 -1
sound/i2c/other/ak4114.c
··· 92 92 .dev_free = snd_ak4114_dev_free, 93 93 }; 94 94 95 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 95 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 96 96 if (chip == NULL) 97 97 return -ENOMEM; 98 98 spin_lock_init(&chip->lock);
+1 -1
sound/i2c/other/ak4117.c
··· 83 83 .dev_free = snd_ak4117_dev_free, 84 84 }; 85 85 86 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 86 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 87 87 if (chip == NULL) 88 88 return -ENOMEM; 89 89 spin_lock_init(&chip->lock);
+1 -1
sound/i2c/tea6330t.c
··· 281 281 u8 default_treble, default_bass; 282 282 unsigned char bytes[7]; 283 283 284 - tea = kcalloc(1, sizeof(*tea), GFP_KERNEL); 284 + tea = kzalloc(sizeof(*tea), GFP_KERNEL); 285 285 if (tea == NULL) 286 286 return -ENOMEM; 287 287 if ((err = snd_i2c_device_create(bus, "TEA6330T", TEA6330T_ADDR, &device)) < 0) {
+1 -1
sound/pcmcia/pdaudiocf/pdaudiocf_core.c
··· 151 151 { 152 152 pdacf_t *chip; 153 153 154 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 154 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 155 155 if (chip == NULL) 156 156 return NULL; 157 157 chip->card = card;
+1 -1
sound/ppc/pmac.c
··· 1160 1160 snd_runtime_check(chip_return, return -EINVAL); 1161 1161 *chip_return = NULL; 1162 1162 1163 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1163 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 1164 1164 if (chip == NULL) 1165 1165 return -ENOMEM; 1166 1166 chip->card = card;
+1 -1
sound/sparc/amd7930.c
··· 967 967 int err; 968 968 969 969 *ramd = NULL; 970 - amd = kcalloc(1, sizeof(*amd), GFP_KERNEL); 970 + amd = kzalloc(sizeof(*amd), GFP_KERNEL); 971 971 if (amd == NULL) 972 972 return -ENOMEM; 973 973
+2 -2
sound/sparc/cs4231.c
··· 1969 1969 int err; 1970 1970 1971 1971 *rchip = NULL; 1972 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1972 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 1973 1973 if (chip == NULL) 1974 1974 return -ENOMEM; 1975 1975 ··· 2083 2083 int err; 2084 2084 2085 2085 *rchip = NULL; 2086 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2086 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 2087 2087 if (chip == NULL) 2088 2088 return -ENOMEM; 2089 2089
+1 -1
sound/synth/emux/emux.c
··· 40 40 snd_emux_t *emu; 41 41 42 42 *remu = NULL; 43 - emu = kcalloc(1, sizeof(*emu), GFP_KERNEL); 43 + emu = kzalloc(sizeof(*emu), GFP_KERNEL); 44 44 if (emu == NULL) 45 45 return -ENOMEM; 46 46
+1 -1
sound/synth/emux/emux_seq.c
··· 146 146 int i, type, cap; 147 147 148 148 /* Allocate structures for this channel */ 149 - if ((p = kcalloc(1, sizeof(*p), GFP_KERNEL)) == NULL) { 149 + if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) { 150 150 snd_printk("no memory\n"); 151 151 return NULL; 152 152 }
+4 -4
sound/synth/emux/soundfont.c
··· 266 266 } 267 267 268 268 /* not found -- create a new one */ 269 - sf = kcalloc(1, sizeof(*sf), GFP_KERNEL); 269 + sf = kzalloc(sizeof(*sf), GFP_KERNEL); 270 270 if (sf == NULL) 271 271 return NULL; 272 272 sf->id = sflist->fonts_size; ··· 346 346 { 347 347 snd_sf_zone_t *zp; 348 348 349 - if ((zp = kcalloc(1, sizeof(*zp), GFP_KERNEL)) == NULL) 349 + if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL) 350 350 return NULL; 351 351 zp->next = sf->zones; 352 352 sf->zones = zp; ··· 377 377 { 378 378 snd_sf_sample_t *sp; 379 379 380 - if ((sp = kcalloc(1, sizeof(*sp), GFP_KERNEL)) == NULL) 380 + if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL) 381 381 return NULL; 382 382 383 383 sp->next = sf->samples; ··· 1362 1362 { 1363 1363 snd_sf_list_t *sflist; 1364 1364 1365 - if ((sflist = kcalloc(1, sizeof(*sflist), GFP_KERNEL)) == NULL) 1365 + if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL) 1366 1366 return NULL; 1367 1367 1368 1368 init_MUTEX(&sflist->presets_mutex);
+1 -1
sound/synth/util_mem.c
··· 38 38 { 39 39 snd_util_memhdr_t *hdr; 40 40 41 - hdr = kcalloc(1, sizeof(*hdr), GFP_KERNEL); 41 + hdr = kzalloc(sizeof(*hdr), GFP_KERNEL); 42 42 if (hdr == NULL) 43 43 return NULL; 44 44 hdr->size = memsize;
+1 -1
sound/usb/usbaudio.c
··· 3136 3136 return -ENOMEM; 3137 3137 } 3138 3138 3139 - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 3139 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 3140 3140 if (! chip) { 3141 3141 snd_card_free(card); 3142 3142 return -ENOMEM;
+3 -3
sound/usb/usbmidi.c
··· 841 841 int length; 842 842 843 843 rep->in = NULL; 844 - ep = kcalloc(1, sizeof(*ep), GFP_KERNEL); 844 + ep = kzalloc(sizeof(*ep), GFP_KERNEL); 845 845 if (!ep) 846 846 return -ENOMEM; 847 847 ep->umidi = umidi; ··· 913 913 void* buffer; 914 914 915 915 rep->out = NULL; 916 - ep = kcalloc(1, sizeof(*ep), GFP_KERNEL); 916 + ep = kzalloc(sizeof(*ep), GFP_KERNEL); 917 917 if (!ep) 918 918 return -ENOMEM; 919 919 ep->umidi = umidi; ··· 1537 1537 int out_ports, in_ports; 1538 1538 int i, err; 1539 1539 1540 - umidi = kcalloc(1, sizeof(*umidi), GFP_KERNEL); 1540 + umidi = kzalloc(sizeof(*umidi), GFP_KERNEL); 1541 1541 if (!umidi) 1542 1542 return -ENOMEM; 1543 1543 umidi->chip = chip;
+5 -5
sound/usb/usbmixer.c
··· 824 824 if (check_ignored_ctl(state, unitid, control)) 825 825 return; 826 826 827 - cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); 827 + cval = kzalloc(sizeof(*cval), GFP_KERNEL); 828 828 if (! cval) { 829 829 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 830 830 return; ··· 997 997 if (check_ignored_ctl(state, unitid, 0)) 998 998 return; 999 999 1000 - cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); 1000 + cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1001 1001 if (! cval) 1002 1002 return; 1003 1003 ··· 1244 1244 continue; 1245 1245 if (check_ignored_ctl(state, unitid, valinfo->control)) 1246 1246 continue; 1247 - cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); 1247 + cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1248 1248 if (! cval) { 1249 1249 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1250 1250 return -ENOMEM; ··· 1430 1430 if (check_ignored_ctl(state, unitid, 0)) 1431 1431 return 0; 1432 1432 1433 - cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); 1433 + cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1434 1434 if (! cval) { 1435 1435 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1436 1436 return -ENOMEM; ··· 1945 1945 1946 1946 strcpy(chip->card->mixername, "USB Mixer"); 1947 1947 1948 - mixer = kcalloc(1, sizeof(*mixer), GFP_KERNEL); 1948 + mixer = kzalloc(sizeof(*mixer), GFP_KERNEL); 1949 1949 if (!mixer) 1950 1950 return -ENOMEM; 1951 1951 mixer->chip = chip;
+1 -1
sound/usb/usx2y/usbusx2yaudio.c
··· 957 957 958 958 for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; 959 959 i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { 960 - usX2Y_substream[i] = kcalloc(1, sizeof(snd_usX2Y_substream_t), GFP_KERNEL); 960 + usX2Y_substream[i] = kzalloc(sizeof(snd_usX2Y_substream_t), GFP_KERNEL); 961 961 if (NULL == usX2Y_substream[i]) { 962 962 snd_printk(KERN_ERR "cannot malloc\n"); 963 963 return -ENOMEM;