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

Commit 59feddb2 authored by Panagiotis Issaris's avatar Panagiotis Issaris Committed by Jaroslav Kysela
Browse files

[ALSA] Conversions from kmalloc+memset to k(z|c)alloc



sound: Conversions from kmalloc+memset to k(c|z)alloc.

Signed-off-by: default avatarPanagiotis Issaris <takis@issaris.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent fb6a0d63
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -988,13 +988,12 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix
	if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) {
		struct snd_ctl_elem_info *uinfo;

		uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL);
		uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
		if (! uinfo) {
			up_read(&mixer->card->controls_rwsem);
			return -ENOMEM;
		}
			
		memset(uinfo, 0, sizeof(*uinfo));
		if (kctl->info(kctl, uinfo)) {
			up_read(&mixer->card->controls_rwsem);
			return 0;
+1 −2
Original line number Diff line number Diff line
@@ -372,10 +372,9 @@ static struct ops_list * create_driver(char *id)
{
	struct ops_list *ops;

	ops = kmalloc(sizeof(*ops), GFP_KERNEL);
	ops = kzalloc(sizeof(*ops), GFP_KERNEL);
	if (ops == NULL)
		return ops;
	memset(ops, 0, sizeof(*ops));

	/* set up driver entry */
	strlcpy(ops->id, id, sizeof(ops->id));
+3 −6
Original line number Diff line number Diff line
@@ -68,21 +68,18 @@ void *snd_malloc_sgbuf_pages(struct device *device,

	dmab->area = NULL;
	dmab->addr = 0;
	dmab->private_data = sgbuf = kmalloc(sizeof(*sgbuf), GFP_KERNEL);
	dmab->private_data = sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL);
	if (! sgbuf)
		return NULL;
	memset(sgbuf, 0, sizeof(*sgbuf));
	sgbuf->dev = device;
	pages = snd_sgbuf_aligned_pages(size);
	sgbuf->tblsize = sgbuf_align_table(pages);
	sgbuf->table = kmalloc(sizeof(*sgbuf->table) * sgbuf->tblsize, GFP_KERNEL);
	sgbuf->table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->table), GFP_KERNEL);
	if (! sgbuf->table)
		goto _failed;
	memset(sgbuf->table, 0, sizeof(*sgbuf->table) * sgbuf->tblsize);
	sgbuf->page_table = kmalloc(sizeof(*sgbuf->page_table) * sgbuf->tblsize, GFP_KERNEL);
	sgbuf->page_table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->page_table), GFP_KERNEL);
	if (! sgbuf->page_table)
		goto _failed;
	memset(sgbuf->page_table, 0, sizeof(*sgbuf->page_table) * sgbuf->tblsize);

	/* allocate each page */
	for (i = 0; i < pages; i++) {
+2 −5
Original line number Diff line number Diff line
@@ -1252,18 +1252,15 @@ static int vx_init_audio_io(struct vx_core *chip)
	chip->audio_info = rmh.Stat[1];

	/* allocate pipes */
	chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL);
	chip->playback_pipes = kcalloc(chip->audio_outs, sizeof(struct vx_pipe *), GFP_KERNEL);
	if (!chip->playback_pipes)
		return -ENOMEM;
	chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL);
	chip->capture_pipes = kcalloc(chip->audio_ins, sizeof(struct vx_pipe *), GFP_KERNEL);
	if (!chip->capture_pipes) {
		kfree(chip->playback_pipes);
		return -ENOMEM;
	}

	memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs);
	memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins);

	preferred = chip->ibl.size;
	chip->ibl.size = 0;
	vx_set_ibl(chip, &chip->ibl); /* query the info */
+2 −2
Original line number Diff line number Diff line
@@ -236,9 +236,9 @@ static int pcm_open(struct snd_pcm_substream *substream,
	chip = snd_pcm_substream_chip(substream);
	runtime = substream->runtime;

	if (!(pipe = kmalloc(sizeof(struct audiopipe), GFP_KERNEL)))
	pipe = kzalloc(sizeof(struct audiopipe), GFP_KERNEL);
	if (!pipe)
		return -ENOMEM;
	memset(pipe, 0, sizeof(struct audiopipe));
	pipe->index = -1;		/* Not configured yet */

	/* Set up hw capabilities and contraints */
Loading