From patchwork Sat Aug 6 15:19:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 1041692 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p76FLZ28004027 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 6 Aug 2011 15:21:56 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p76FKJlX032097 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 6 Aug 2011 10:20:19 -0500 Received: from linux.omap.com (smtp-le.itg.ti.com [157.170.170.27]) by dlep33.itg.ti.com (8.13.7/8.13.8) with ESMTP id p76FKIof026751; Sat, 6 Aug 2011 10:20:18 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 7CDBC80627; Sat, 6 Aug 2011 10:20:18 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 9517080626 for ; Sat, 6 Aug 2011 10:20:17 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id p76FKHBM017037 for ; Sat, 6 Aug 2011 10:20:17 -0500 (CDT) Received: from psmtp.com (na3sys009amx242.postini.com [74.125.149.126]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id p76FKEs8024174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 6 Aug 2011 10:20:16 -0500 Received: from mail-ww0-f47.google.com ([74.125.82.47]) (using TLSv1) by na3sys009amx242.postini.com ([74.125.148.10]) with SMTP; Sat, 06 Aug 2011 15:20:17 GMT Received: by wwf4 with SMTP id 4so1319236wwf.4 for ; Sat, 06 Aug 2011 08:20:12 -0700 (PDT) Received: by 10.227.9.95 with SMTP id k31mr2968082wbk.71.1312644012502; Sat, 06 Aug 2011 08:20:12 -0700 (PDT) Received: from [192.168.2.2] ([91.79.100.214]) by mx.google.com with ESMTPS id b13sm3089342wbh.58.2011.08.06.08.20.10 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 06 Aug 2011 08:20:11 -0700 (PDT) Message-ID: <4E3D5B88.1070606@ru.mvista.com> Date: Sat, 06 Aug 2011 19:19:36 +0400 From: Sergei Shtylyov User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: davinci-linux-open-source@linux.davincidsp.com, Nori Sekhar , Kevin Hilman Subject: Fwd: [PATCH] arm: mach-davinci: use kzalloc() References: <1312629976.5589.128.camel@localhost.localdomain> In-Reply-To: <1312629976.5589.128.camel@localhost.localdomain> X-Forwarded-Message-Id: <1312629976.5589.128.camel@localhost.localdomain> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [35/1] Cc: thomas@m3y3r.de X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 06 Aug 2011 15:21:56 +0000 (UTC) Hello. Thomas, for the future, please send the DaVinci patches to the DaVinci mailing list and maintainers. WBR, Sergei -------- Original Message -------- Subject: [PATCH] arm: mach-davinci: use kzalloc() Date: Sat, 06 Aug 2011 13:26:13 +0200 From: Thomas Meyer To: Russell King , linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List From: Thomas Meyer Use kzalloc rather than kmalloc followed by memset with 0 This considers some simple cases that are common and easy to validate Note in particular that there are no ...s in the rule, so all of the matched code has to be contiguous The semantic patch that makes this output is available in scripts/coccinelle/api/alloc/kzalloc-simple.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Thomas Meyer diff -u -p a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c --- a/arch/arm/mach-davinci/dma.c 2010-10-26 18:50:12.713889353 +0200 +++ b/arch/arm/mach-davinci/dma.c 2011-08-01 20:40:38.326583216 +0200 @@ -1435,12 +1435,11 @@ static int __init edma_probe(struct plat goto fail1; } - edma_cc[j] = kmalloc(sizeof(struct edma), GFP_KERNEL); + edma_cc[j] = kzalloc(sizeof(struct edma), GFP_KERNEL); if (!edma_cc[j]) { status = -ENOMEM; goto fail1; } - memset(edma_cc[j], 0, sizeof(struct edma)); edma_cc[j]->num_channels = min_t(unsigned, info[j]->n_channel, EDMA_MAX_DMACH);