diff mbox

[09/11] UBUNTU: SAUCE: (drop after 2.6.39) staging: rts_pstor: optimize kmalloc to kzalloc

Message ID 1301543473-11146-10-git-send-email-keng-yu.lin@canonical.com
State New
Headers show

Commit Message

Keng-Yu Lin March 31, 2011, 3:51 a.m. UTC
From: Alexander Beregalov <a.beregalov@gmail.com>

Use kzalloc rather than kmalloc followed by memset with 0.
Found by coccinelle.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

BugLink: http://bugs.launchpad.net/bugs/698006
(cherry picked from commit 1840c15b0a504fed6ee08b475245a964336b76e6)

Signed-off-by: Keng-Yu Lin <keng-yu.lin@canonical.com>
---
 drivers/staging/rts_pstor/rtsx.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c
index c3f33d1..db3470e 100644
--- a/drivers/staging/rts_pstor/rtsx.c
+++ b/drivers/staging/rts_pstor/rtsx.c
@@ -931,11 +931,10 @@  static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id
 	dev = host_to_rtsx(host);
 	memset(dev, 0, sizeof(struct rtsx_dev));
 
-	dev->chip = (struct rtsx_chip *)kmalloc(sizeof(struct rtsx_chip), GFP_KERNEL);
+	dev->chip = kzalloc(sizeof(struct rtsx_chip), GFP_KERNEL);
 	if (dev->chip == NULL) {
 		goto errout;
 	}
-	memset(dev->chip, 0, sizeof(struct rtsx_chip));
 
 	spin_lock_init(&dev->reg_lock);
 	mutex_init(&(dev->dev_mutex));