Commit ca2c0966 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Replace with kzalloc() - core stuff

Control Midlevel,ALSA Core,HWDEP Midlevel,PCM Midlevel,RawMidi Midlevel
Timer Midlevel,ALSA<-OSS emulation
Replace kcalloc(1,..) with kzalloc().
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8648811f
...@@ -69,7 +69,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) ...@@ -69,7 +69,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
err = -EFAULT; err = -EFAULT;
goto __error2; goto __error2;
} }
ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL); ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
if (ctl == NULL) { if (ctl == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto __error; goto __error;
...@@ -162,7 +162,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id) ...@@ -162,7 +162,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id)
goto _found; goto _found;
} }
} }
ev = kcalloc(1, sizeof(*ev), GFP_ATOMIC); ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
if (ev) { if (ev) {
ev->id = *id; ev->id = *id;
ev->mask = mask; ev->mask = mask;
...@@ -195,7 +195,7 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access) ...@@ -195,7 +195,7 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access)
snd_runtime_check(control != NULL, return NULL); snd_runtime_check(control != NULL, return NULL);
snd_runtime_check(control->count > 0, return NULL); snd_runtime_check(control->count > 0, return NULL);
kctl = kcalloc(1, sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL);
if (kctl == NULL) if (kctl == NULL)
return NULL; return NULL;
*kctl = *control; *kctl = *control;
...@@ -521,7 +521,7 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, ...@@ -521,7 +521,7 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl,
{ {
snd_ctl_card_info_t *info; snd_ctl_card_info_t *info;
info = kcalloc(1, sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (! info) if (! info)
return -ENOMEM; return -ENOMEM;
down_read(&snd_ioctl_rwsem); down_read(&snd_ioctl_rwsem);
...@@ -929,7 +929,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int ...@@ -929,7 +929,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int
return -EINVAL; return -EINVAL;
} }
private_size *= info->count; private_size *= info->count;
ue = kcalloc(1, sizeof(struct user_element) + private_size, GFP_KERNEL); ue = kzalloc(sizeof(struct user_element) + private_size, GFP_KERNEL);
if (ue == NULL) if (ue == NULL)
return -ENOMEM; return -ENOMEM;
ue->info = *info; ue->info = *info;
...@@ -1185,7 +1185,7 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head * ...@@ -1185,7 +1185,7 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *
{ {
snd_kctl_ioctl_t *pn; snd_kctl_ioctl_t *pn;
pn = kcalloc(1, sizeof(snd_kctl_ioctl_t), GFP_KERNEL); pn = kzalloc(sizeof(snd_kctl_ioctl_t), GFP_KERNEL);
if (pn == NULL) if (pn == NULL)
return -ENOMEM; return -ENOMEM;
pn->fioctl = fcn; pn->fioctl = fcn;
......
...@@ -92,7 +92,7 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i ...@@ -92,7 +92,7 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i
struct sndrv_ctl_elem_info *data; struct sndrv_ctl_elem_info *data;
int err; int err;
data = kcalloc(1, sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (! data) if (! data)
return -ENOMEM; return -ENOMEM;
...@@ -271,7 +271,7 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card, ...@@ -271,7 +271,7 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card,
struct sndrv_ctl_elem_value *data; struct sndrv_ctl_elem_value *data;
int err, type, count; int err, type, count;
data = kcalloc(1, sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (data == NULL) if (data == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -291,7 +291,7 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file, ...@@ -291,7 +291,7 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file,
struct sndrv_ctl_elem_value *data; struct sndrv_ctl_elem_value *data;
int err, type, count; int err, type, count;
data = kcalloc(1, sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (data == NULL) if (data == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -313,7 +313,7 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file, ...@@ -313,7 +313,7 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file,
struct sndrv_ctl_elem_info *data; struct sndrv_ctl_elem_info *data;
int err; int err;
data = kcalloc(1, sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (! data) if (! data)
return -ENOMEM; return -ENOMEM;
......
...@@ -49,7 +49,7 @@ int snd_device_new(snd_card_t *card, snd_device_type_t type, ...@@ -49,7 +49,7 @@ int snd_device_new(snd_card_t *card, snd_device_type_t type,
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
snd_assert(device_data != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO);
snd_assert(ops != NULL, return -ENXIO); snd_assert(ops != NULL, return -ENXIO);
dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) if (dev == NULL)
return -ENOMEM; return -ENOMEM;
dev->card = card; dev->card = card;
......
...@@ -359,7 +359,7 @@ int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep ...@@ -359,7 +359,7 @@ int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep
snd_assert(rhwdep != NULL, return -EINVAL); snd_assert(rhwdep != NULL, return -EINVAL);
*rhwdep = NULL; *rhwdep = NULL;
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
hwdep = kcalloc(1, sizeof(*hwdep), GFP_KERNEL); hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
if (hwdep == NULL) if (hwdep == NULL)
return -ENOMEM; return -ENOMEM;
hwdep->card = card; hwdep->card = card;
......
...@@ -295,7 +295,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) ...@@ -295,7 +295,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
goto __error; goto __error;
} }
} }
data = kcalloc(1, sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (data == NULL) { if (data == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto __error; goto __error;
...@@ -304,7 +304,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) ...@@ -304,7 +304,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
switch (entry->content) { switch (entry->content) {
case SNDRV_INFO_CONTENT_TEXT: case SNDRV_INFO_CONTENT_TEXT:
if (mode == O_RDONLY || mode == O_RDWR) { if (mode == O_RDONLY || mode == O_RDWR) {
buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
if (buffer == NULL) { if (buffer == NULL) {
kfree(data); kfree(data);
err = -ENOMEM; err = -ENOMEM;
...@@ -323,7 +323,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) ...@@ -323,7 +323,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
data->rbuffer = buffer; data->rbuffer = buffer;
} }
if (mode == O_WRONLY || mode == O_RDWR) { if (mode == O_WRONLY || mode == O_RDWR) {
buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
if (buffer == NULL) { if (buffer == NULL) {
if (mode == O_RDWR) { if (mode == O_RDWR) {
vfree(data->rbuffer->buffer); vfree(data->rbuffer->buffer);
...@@ -752,7 +752,7 @@ char *snd_info_get_str(char *dest, char *src, int len) ...@@ -752,7 +752,7 @@ char *snd_info_get_str(char *dest, char *src, int len)
static snd_info_entry_t *snd_info_create_entry(const char *name) static snd_info_entry_t *snd_info_create_entry(const char *name)
{ {
snd_info_entry_t *entry; snd_info_entry_t *entry;
entry = kcalloc(1, sizeof(*entry), GFP_KERNEL); entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (entry == NULL) if (entry == NULL)
return NULL; return NULL;
entry->name = kstrdup(name, GFP_KERNEL); entry->name = kstrdup(name, GFP_KERNEL);
......
...@@ -72,7 +72,7 @@ snd_card_t *snd_card_new(int idx, const char *xid, ...@@ -72,7 +72,7 @@ snd_card_t *snd_card_new(int idx, const char *xid,
if (extra_size < 0) if (extra_size < 0)
extra_size = 0; extra_size = 0;
card = kcalloc(1, sizeof(*card) + extra_size, GFP_KERNEL); card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
if (card == NULL) if (card == NULL)
return NULL; return NULL;
if (xid) { if (xid) {
...@@ -702,7 +702,7 @@ static int snd_generic_device_register(snd_card_t *card) ...@@ -702,7 +702,7 @@ static int snd_generic_device_register(snd_card_t *card)
if (card->generic_dev) if (card->generic_dev)
return 0; /* already registered */ return 0; /* already registered */
dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (! dev) { if (! dev) {
snd_printk(KERN_ERR "can't allocate generic_device\n"); snd_printk(KERN_ERR "can't allocate generic_device\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -53,7 +53,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) ...@@ -53,7 +53,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
err = snd_card_file_add(card, file); err = snd_card_file_add(card, file);
if (err < 0) if (err < 0)
return err; return err;
fmixer = kcalloc(1, sizeof(*fmixer), GFP_KERNEL); fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
if (fmixer == NULL) { if (fmixer == NULL) {
snd_card_file_remove(card, file); snd_card_file_remove(card, file);
return -ENOMEM; return -ENOMEM;
...@@ -517,8 +517,8 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer, ...@@ -517,8 +517,8 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer,
up_read(&card->controls_rwsem); up_read(&card->controls_rwsem);
return; return;
} }
uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL) if (uinfo == NULL || uctl == NULL)
goto __unalloc; goto __unalloc;
snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
...@@ -551,8 +551,8 @@ static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer, ...@@ -551,8 +551,8 @@ static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer,
up_read(&card->controls_rwsem); up_read(&card->controls_rwsem);
return; return;
} }
uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL) if (uinfo == NULL || uctl == NULL)
goto __unalloc; goto __unalloc;
snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
...@@ -612,8 +612,8 @@ static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer, ...@@ -612,8 +612,8 @@ static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer,
down_read(&card->controls_rwsem); down_read(&card->controls_rwsem);
if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) if ((kctl = snd_ctl_find_numid(card, numid)) == NULL)
return; return;
uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL) if (uinfo == NULL || uctl == NULL)
goto __unalloc; goto __unalloc;
snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
...@@ -649,8 +649,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer, ...@@ -649,8 +649,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer,
up_read(&fmixer->card->controls_rwsem); up_read(&fmixer->card->controls_rwsem);
return; return;
} }
uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL) if (uinfo == NULL || uctl == NULL)
goto __unalloc; goto __unalloc;
snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
...@@ -768,8 +768,8 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int ...@@ -768,8 +768,8 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
snd_ctl_elem_value_t *uctl; snd_ctl_elem_value_t *uctl;
int err, idx; int err, idx;
uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL) { if (uinfo == NULL || uctl == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto __unlock; goto __unlock;
...@@ -813,8 +813,8 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int ...@@ -813,8 +813,8 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
int err; int err;
unsigned int idx; unsigned int idx;
uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
if (uinfo == NULL || uctl == NULL) { if (uinfo == NULL || uctl == NULL) {
err = -ENOMEM; err = -ENOMEM;
goto __unlock; goto __unlock;
......
...@@ -1740,7 +1740,7 @@ static int snd_pcm_oss_open_file(struct file *file, ...@@ -1740,7 +1740,7 @@ static int snd_pcm_oss_open_file(struct file *file,
snd_assert(rpcm_oss_file != NULL, return -EINVAL); snd_assert(rpcm_oss_file != NULL, return -EINVAL);
*rpcm_oss_file = NULL; *rpcm_oss_file = NULL;
pcm_oss_file = kcalloc(1, sizeof(*pcm_oss_file), GFP_KERNEL); pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
if (pcm_oss_file == NULL) if (pcm_oss_file == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -171,7 +171,7 @@ int snd_pcm_plugin_build(snd_pcm_plug_t *plug, ...@@ -171,7 +171,7 @@ int snd_pcm_plugin_build(snd_pcm_plug_t *plug,
snd_assert(plug != NULL, return -ENXIO); snd_assert(plug != NULL, return -ENXIO);
snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO); snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO);
plugin = kcalloc(1, sizeof(*plugin) + extra, GFP_KERNEL); plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL);
if (plugin == NULL) if (plugin == NULL)
return -ENOMEM; return -ENOMEM;
plugin->name = name; plugin->name = name;
......
...@@ -597,7 +597,7 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count) ...@@ -597,7 +597,7 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count)
} }
prev = NULL; prev = NULL;
for (idx = 0, prev = NULL; idx < substream_count; idx++) { for (idx = 0, prev = NULL; idx < substream_count; idx++) {
substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); substream = kzalloc(sizeof(*substream), GFP_KERNEL);
if (substream == NULL) if (substream == NULL)
return -ENOMEM; return -ENOMEM;
substream->pcm = pcm; substream->pcm = pcm;
...@@ -657,7 +657,7 @@ int snd_pcm_new(snd_card_t * card, char *id, int device, ...@@ -657,7 +657,7 @@ int snd_pcm_new(snd_card_t * card, char *id, int device,
snd_assert(rpcm != NULL, return -EINVAL); snd_assert(rpcm != NULL, return -EINVAL);
*rpcm = NULL; *rpcm = NULL;
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
pcm = kcalloc(1, sizeof(*pcm), GFP_KERNEL); pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
if (pcm == NULL) if (pcm == NULL)
return -ENOMEM; return -ENOMEM;
pcm->card = card; pcm->card = card;
...@@ -795,7 +795,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, ...@@ -795,7 +795,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream,
if (substream == NULL) if (substream == NULL)
return -EAGAIN; return -EAGAIN;
runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL); runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
if (runtime == NULL) if (runtime == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -321,7 +321,7 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size) ...@@ -321,7 +321,7 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size)
if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) { if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) {
dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ dmab = &substream->dma_buffer; /* use the pre-allocated buffer */
} else { } else {
dmab = kcalloc(1, sizeof(*dmab), GFP_KERNEL); dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
if (! dmab) if (! dmab)
return -ENOMEM; return -ENOMEM;
dmab->dev = substream->dma_buffer.dev; dmab->dev = substream->dma_buffer.dev;
......
...@@ -2001,7 +2001,7 @@ static int snd_pcm_open_file(struct file *file, ...@@ -2001,7 +2001,7 @@ static int snd_pcm_open_file(struct file *file,
snd_assert(rpcm_file != NULL, return -EINVAL); snd_assert(rpcm_file != NULL, return -EINVAL);
*rpcm_file = NULL; *rpcm_file = NULL;
pcm_file = kcalloc(1, sizeof(*pcm_file), GFP_KERNEL); pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL);
if (pcm_file == NULL) { if (pcm_file == NULL) {
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -101,7 +101,7 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream) ...@@ -101,7 +101,7 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream)
{ {
snd_rawmidi_runtime_t *runtime; snd_rawmidi_runtime_t *runtime;
if ((runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL)) == NULL) if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
spin_lock_init(&runtime->lock); spin_lock_init(&runtime->lock);
init_waitqueue_head(&runtime->sleep); init_waitqueue_head(&runtime->sleep);
...@@ -1374,7 +1374,7 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi, ...@@ -1374,7 +1374,7 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi,
INIT_LIST_HEAD(&stream->substreams); INIT_LIST_HEAD(&stream->substreams);
for (idx = 0; idx < count; idx++) { for (idx = 0; idx < count; idx++) {
substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); substream = kzalloc(sizeof(*substream), GFP_KERNEL);
if (substream == NULL) if (substream == NULL)
return -ENOMEM; return -ENOMEM;
substream->stream = direction; substream->stream = direction;
...@@ -1417,7 +1417,7 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device, ...@@ -1417,7 +1417,7 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device,
snd_assert(rrawmidi != NULL, return -EINVAL); snd_assert(rrawmidi != NULL, return -EINVAL);
*rrawmidi = NULL; *rrawmidi = NULL;
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
rmidi = kcalloc(1, sizeof(*rmidi), GFP_KERNEL); rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
if (rmidi == NULL) if (rmidi == NULL)
return -ENOMEM; return -ENOMEM;
rmidi->card = card; rmidi->card = card;
......
...@@ -98,7 +98,7 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left); ...@@ -98,7 +98,7 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left);
static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer) static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer)
{ {
snd_timer_instance_t *timeri; snd_timer_instance_t *timeri;
timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL); timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
if (timeri == NULL) if (timeri == NULL)
return NULL; return NULL;
timeri->owner = kstrdup(owner, GFP_KERNEL); timeri->owner = kstrdup(owner, GFP_KERNEL);
...@@ -764,7 +764,7 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t * ...@@ -764,7 +764,7 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t *
snd_assert(tid != NULL, return -EINVAL); snd_assert(tid != NULL, return -EINVAL);
snd_assert(rtimer != NULL, return -EINVAL); snd_assert(rtimer != NULL, return -EINVAL);
*rtimer = NULL; *rtimer = NULL;
timer = kcalloc(1, sizeof(*timer), GFP_KERNEL); timer = kzalloc(sizeof(*timer), GFP_KERNEL);
if (timer == NULL) if (timer == NULL)
return -ENOMEM; return -ENOMEM;
timer->tmr_class = tid->dev_class; timer->tmr_class = tid->dev_class;
...@@ -1017,7 +1017,7 @@ static int snd_timer_register_system(void) ...@@ -1017,7 +1017,7 @@ static int snd_timer_register_system(void)
return err; return err;
strcpy(timer->name, "system timer"); strcpy(timer->name, "system timer");
timer->hw = snd_timer_system; timer->hw = snd_timer_system;
priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (priv == NULL) { if (priv == NULL) {
snd_timer_free(timer); snd_timer_free(timer);
return -ENOMEM; return -ENOMEM;
...@@ -1202,7 +1202,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file) ...@@ -1202,7 +1202,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
{ {
snd_timer_user_t *tu; snd_timer_user_t *tu;
tu = kcalloc(1, sizeof(*tu), GFP_KERNEL); tu = kzalloc(sizeof(*tu), GFP_KERNEL);
if (tu == NULL) if (tu == NULL)
return -ENOMEM; return -ENOMEM;
spin_lock_init(&tu->qlock); spin_lock_init(&tu->qlock);
...@@ -1513,7 +1513,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info ...@@ -1513,7 +1513,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info
t = tu->timeri->timer; t = tu->timeri->timer;
snd_assert(t != NULL, return -ENXIO); snd_assert(t != NULL, return -ENXIO);
info = kcalloc(1, sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (! info) if (! info)
return -ENOMEM; return -ENOMEM;
info->card = t->card ? t->card->number : -1; info->card = t->card ? t->card->number : -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment