Commit 4ca7deb1 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: topology: Use kcalloc instead of kzalloc for array allocation

Also remove unnecessary memset.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d770e558
...@@ -1070,7 +1070,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create( ...@@ -1070,7 +1070,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create(
struct snd_soc_tplg_mixer_control *mc; struct snd_soc_tplg_mixer_control *mc;
int i, err; int i, err;
kc = kzalloc(sizeof(*kc) * num_kcontrols, GFP_KERNEL); kc = kcalloc(num_kcontrols, sizeof(*kc), GFP_KERNEL);
if (kc == NULL) if (kc == NULL)
return NULL; return NULL;
...@@ -1251,7 +1251,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create( ...@@ -1251,7 +1251,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create(
struct snd_kcontrol_new *kc; struct snd_kcontrol_new *kc;
int i, err; int i, err;
kc = kzalloc(sizeof(*kc) * count, GFP_KERNEL); kc = kcalloc(count, sizeof(*kc), GFP_KERNEL);
if (!kc) if (!kc)
return NULL; return NULL;
...@@ -1274,7 +1274,6 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create( ...@@ -1274,7 +1274,6 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create(
"ASoC: adding bytes kcontrol %s with access 0x%x\n", "ASoC: adding bytes kcontrol %s with access 0x%x\n",
be->hdr.name, be->hdr.access); be->hdr.name, be->hdr.access);
memset(kc, 0, sizeof(*kc));
kc[i].name = be->hdr.name; kc[i].name = be->hdr.name;
kc[i].private_value = (long)sbe; kc[i].private_value = (long)sbe;
kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
......
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