]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ASoC: topology: Use kcalloc instead of kzalloc for array allocation
authorAxel Lin <axel.lin@ingics.com>
Wed, 5 Aug 2015 14:34:22 +0000 (22:34 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 6 Aug 2015 11:35:15 +0000 (12:35 +0100)
Also remove unnecessary memset.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-topology.c

index d0960683c4093c4303743b1e7e4f93190e11a3a5..f038c6ef80055344cc1e0e38584d3698f89ec05d 100644 (file)
@@ -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;
 
@@ -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;
 
@@ -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;