From patchwork Sat May 1 18:01:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 96299 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o41I1FYS001884 for ; Sat, 1 May 2010 18:01:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751934Ab0EASBE (ORCPT ); Sat, 1 May 2010 14:01:04 -0400 Received: from ns1.siteground211.com ([209.62.36.12]:44227 "EHLO serv01.siteground211.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289Ab0EASBC (ORCPT ); Sat, 1 May 2010 14:01:02 -0400 Received: from [91.154.117.150] (port=24523 helo=gandalf) by serv01.siteground211.com with esmtpa (Exim 4.69) (envelope-from ) id 1O8Gzx-0004S3-NX; Sat, 01 May 2010 13:01:07 -0500 From: Felipe Balbi To: tony@atomide.com Cc: linux-omap@vger.kernel.org, Felipe Balbi Subject: [CBUS PATCH 2/2] cbus: switch kmalloc() + memset() to kzalloc() Date: Sat, 1 May 2010 21:01:10 +0300 Message-Id: <1272736870-5216-2-git-send-email-felipe.balbi@nokia.com> X-Mailer: git-send-email 1.7.1.rc2.7.g3e7f1 In-Reply-To: <1272736870-5216-1-git-send-email-felipe.balbi@nokia.com> References: <1272736870-5216-1-git-send-email-felipe.balbi@nokia.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - serv01.siteground211.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - felipebalbi.com Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 01 May 2010 18:01:16 +0000 (UTC) diff --git a/drivers/cbus/retu-user.c b/drivers/cbus/retu-user.c index 1a29492..953d92a 100644 --- a/drivers/cbus/retu-user.c +++ b/drivers/cbus/retu-user.c @@ -382,12 +382,12 @@ int retu_user_init(void) struct retu_irq *irq; int res, i; - irq = kmalloc(sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN, GFP_KERNEL); + irq = kzalloc(sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN, GFP_KERNEL); if (irq == NULL) { - printk(KERN_ERR PFX "kmalloc failed\n"); + printk(KERN_ERR PFX "kzalloc failed\n"); return -ENOMEM; } - memset(irq, 0, sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN); + for (i = 0; i < RETU_MAX_IRQ_BUF_LEN; i++) list_add(&irq[i].node, &retu_irqs_reserve); diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c index ef9fc37..5a344b6 100644 --- a/drivers/cbus/tahvo-usb.c +++ b/drivers/cbus/tahvo-usb.c @@ -655,10 +655,10 @@ static int tahvo_usb_probe(struct device *dev) dev_dbg(dev, "probe\n"); /* Create driver data */ - tu = kmalloc(sizeof(*tu), GFP_KERNEL); + tu = kzalloc(sizeof(*tu), GFP_KERNEL); if (!tu) return -ENOMEM; - memset(tu, 0, sizeof(*tu)); + tu->pt_dev = container_of(dev, struct platform_device, dev); #ifdef CONFIG_USB_OTG /* Default mode */ diff --git a/drivers/cbus/tahvo-user.c b/drivers/cbus/tahvo-user.c index 01e7f20..bd30f06 100644 --- a/drivers/cbus/tahvo-user.c +++ b/drivers/cbus/tahvo-user.c @@ -364,12 +364,12 @@ int tahvo_user_init(void) struct tahvo_irq *irq; int res, i; - irq = kmalloc(sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN, GFP_KERNEL); + irq = kzalloc(sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN, GFP_KERNEL); if (irq == NULL) { - printk(KERN_ERR PFX "kmalloc failed\n"); + printk(KERN_ERR PFX "kzalloc failed\n"); return -ENOMEM; } - memset(irq, 0, sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN); + for (i = 0; i < TAHVO_MAX_IRQ_BUF_LEN; i++) list_add(&irq[i].node, &tahvo_irqs_reserve);