aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-08-23 05:51:45 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2013-08-30 16:52:48 -0400
commit8e7fd23686b49c186a15343c82a0a54c3a406234 (patch)
treecf780e9d31496743220b47e2934b303825e25a5a /drivers/mtd
parentff52c67a1048fef9b381b98e17fcaca01b076190 (diff)
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@oracle.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/cs553x_nand.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c
index 2cdeab8bebc4..d469a9a1dea0 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)
197 } 197 }
198 198
199 /* Allocate memory for MTD device structure and private data */ 199 /* Allocate memory for MTD device structure and private data */
200 new_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); 200 new_mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
201 if (!new_mtd) { 201 if (!new_mtd) {
202 printk(KERN_WARNING "Unable to allocate CS553X NAND MTD device structure.\n"); 202 printk(KERN_WARNING "Unable to allocate CS553X NAND MTD device structure.\n");
203 err = -ENOMEM; 203 err = -ENOMEM;
@@ -207,10 +207,6 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
207 /* Get pointer to private data */ 207 /* Get pointer to private data */
208 this = (struct nand_chip *)(&new_mtd[1]); 208 this = (struct nand_chip *)(&new_mtd[1]);
209 209
210 /* Initialize structures */
211 memset(new_mtd, 0, sizeof(struct mtd_info));
212 memset(this, 0, sizeof(struct nand_chip));
213
214 /* Link the private data with the MTD structure */ 210 /* Link the private data with the MTD structure */
215 new_mtd->priv = this; 211 new_mtd->priv = this;
216 new_mtd->owner = THIS_MODULE; 212 new_mtd->owner = THIS_MODULE;