From patchwork Wed Aug 5 14:34:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6950331 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 554E8C05AC for ; Wed, 5 Aug 2015 14:34:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7599820461 for ; Wed, 5 Aug 2015 14:34:48 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 339A120437 for ; Wed, 5 Aug 2015 14:34:47 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 27C56265E28; Wed, 5 Aug 2015 16:34:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 529AE265E04; Wed, 5 Aug 2015 16:34:37 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8A341265E1C; Wed, 5 Aug 2015 16:34:35 +0200 (CEST) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by alsa0.perex.cz (Postfix) with ESMTP id 37E99265DFD for ; Wed, 5 Aug 2015 16:34:29 +0200 (CEST) Received: by pabxd6 with SMTP id xd6so19960754pab.2 for ; Wed, 05 Aug 2015 07:34:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=UBlq1TT05V09FsIGYJFkLtn2g3AdfXk8Ep0YLXDqssI=; b=l4wxgsbmlkV46gXRfsHggfNp7pwbrcg2kIrAujDfii71gKtMxgCw13G2p1tvGaP8KJ +zVWK2OvGVIEwth59XFBNRoQKnXzQgixGwQnfv1aJnt7Ryv1litZL0HvaPQggqY2SrxO al5qMraMY+rCZuZFOe3MXwTJ0TZT02hCuGWcSdmjhySTd5kLFssNglZ/TPT2OaInBdrS 82PiJWzD/rWgZV9lkGg0mNXnahuZ8uUECbc7LqfYfSSSh5JCvBRRPQrLjVzNDFm2a3Ej vfRKmQhaqvkv4EcPoJkH2/uwlp0/ABoIbxxq61Xlbd6r+P85ZdxcZ90YAQQPUOKhFxej e8VA== X-Gm-Message-State: ALoCoQmjZviH7SZCmguMEYzqMnBeszUalnqYk3VQaHtdoSXlwecCjQMdv67e4UlX5O9f1bn2md1i X-Received: by 10.66.145.136 with SMTP id su8mr20155039pab.51.1438785268006; Wed, 05 Aug 2015 07:34:28 -0700 (PDT) Received: from phoenix.local ([60.245.65.112]) by smtp.gmail.com with ESMTPSA id zb2sm3136317pbb.46.2015.08.05.07.34.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2015 07:34:26 -0700 (PDT) Message-ID: <1438785262.9624.0.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Wed, 05 Aug 2015 22:34:22 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: alsa-devel@alsa-project.org, Liam Girdwood Subject: [alsa-devel] [PATCH v2] ASoC: topology: Use kcalloc instead of kzalloc for array allocation X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Also remove unnecessary memset. Signed-off-by: Axel Lin --- v2: One more kcalloc conversion in soc_tplg_dapm_widget_dmixer_create sound/soc/soc-topology.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 4dadb5e..e4b7fc6 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1069,7 +1069,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; @@ -1250,7 +1250,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; @@ -1273,7 +1273,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;