mtd cs553x_nand: use kzalloc() instead of memset
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Aug 30 16:59:05 EDT 2013
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=8e7fd23686b49c186a15343c82a0a54c3a406234
Commit: 8e7fd23686b49c186a15343c82a0a54c3a406234
Parent: ff52c67a1048fef9b381b98e17fcaca01b076190
Author: Dan Carpenter <dan.carpenter at oracle.com>
AuthorDate: Fri Aug 23 12:51:45 2013 +0300
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Aug 30 21:52:48 2013 +0100
mtd cs553x_nand: use kzalloc() instead of memset
It's cleaner to use kzalloc() instead of zeroing out in a separate call
to memset().
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/nand/cs553x_nand.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c
index 2cdeab8..d469a9a 100644
--- a/drivers/mtd/nand/cs553x_nand.c
+++ b/drivers/mtd/nand/cs553x_nand.c
@@ -197,7 +197,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
}
/* Allocate memory for MTD device structure and private data */
- new_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
+ new_mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
if (!new_mtd) {
printk(KERN_WARNING "Unable to allocate CS553X NAND MTD device structure.\n");
err = -ENOMEM;
@@ -207,10 +207,6 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
/* Get pointer to private data */
this = (struct nand_chip *)(&new_mtd[1]);
- /* Initialize structures */
- memset(new_mtd, 0, sizeof(struct mtd_info));
- memset(this, 0, sizeof(struct nand_chip));
-
/* Link the private data with the MTD structure */
new_mtd->priv = this;
new_mtd->owner = THIS_MODULE;
More information about the linux-mtd-cvs
mailing list