Skip to content

Commit

Permalink
ASoC: topology: Use kcalloc instead of kzalloc for array allocation
Browse files Browse the repository at this point in the history
Also remove unnecessary memset.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Aug 6, 2015
1 parent d770e55 commit 4ca7deb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sound/soc/soc-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create(
struct snd_soc_tplg_mixer_control *mc;
int i, err;

kc = kzalloc(sizeof(*kc) * num_kcontrols, GFP_KERNEL);
kc = kcalloc(num_kcontrols, sizeof(*kc), GFP_KERNEL);
if (kc == NULL)
return NULL;

Expand Down Expand Up @@ -1251,7 +1251,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create(
struct snd_kcontrol_new *kc;
int i, err;

kc = kzalloc(sizeof(*kc) * count, GFP_KERNEL);
kc = kcalloc(count, sizeof(*kc), GFP_KERNEL);
if (!kc)
return NULL;

Expand All @@ -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",
be->hdr.name, be->hdr.access);

memset(kc, 0, sizeof(*kc));
kc[i].name = be->hdr.name;
kc[i].private_value = (long)sbe;
kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
Expand Down

0 comments on commit 4ca7deb

Please sign in to comment.