Skip to content

Commit 8e7fd23

Browse files
Dan CarpenterDavid Woodhouse
authored andcommitted
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>
1 parent ff52c67 commit 8e7fd23

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/mtd/nand/cs553x_nand.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
197197
}
198198

199199
/* 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);
201201
if (!new_mtd) {
202202
printk(KERN_WARNING "Unable to allocate CS553X NAND MTD device structure.\n");
203203
err = -ENOMEM;
@@ -207,10 +207,6 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
207207
/* Get pointer to private data */
208208
this = (struct nand_chip *)(&new_mtd[1]);
209209

210-
/* Initialize structures */
211-
memset(new_mtd, 0, sizeof(struct mtd_info));
212-
memset(this, 0, sizeof(struct nand_chip));
213-
214210
/* Link the private data with the MTD structure */
215211
new_mtd->priv = this;
216212
new_mtd->owner = THIS_MODULE;

0 commit comments

Comments
 (0)