Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[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
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -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)
				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)
	
	
	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,
{
{
	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
		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 *
{
{
	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;
+4 −4
Original line number Original line Diff line number Diff line
@@ -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,
	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,
	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,
	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;


+1 −1
Original line number Original line Diff line number Diff line
@@ -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;
+1 −1
Original line number Original line Diff line number Diff line
@@ -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;
+4 −4
Original line number Original line Diff line number Diff line
@@ -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)
	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)
			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)
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);
Loading