[PATCH 2/4] mtd: convert some kmalloc()+memset() calls to kcalloc() in drivers/mtd/maps/pmcmsp-flash.c
Jesper Juhl
jesper.juhl at gmail.com
Sat Aug 25 21:55:20 EDT 2007
mtd: convert some kmalloc()+memset() calls to kcalloc() in drivers/mtd/maps/pmcmsp-flash.c
No point in doing kmalloc() followed by memset() when we have
kcalloc() at our disposal.
Signed-off-by: Jesper Juhl <jesper.juhl at gmail.com>
---
drivers/mtd/maps/pmcmsp-flash.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/maps/pmcmsp-flash.c b/drivers/mtd/maps/pmcmsp-flash.c
index dfdb120..af72cdd 100644
--- a/drivers/mtd/maps/pmcmsp-flash.c
+++ b/drivers/mtd/maps/pmcmsp-flash.c
@@ -75,8 +75,7 @@ int __init init_msp_flash(void)
printk(KERN_NOTICE "Found %d PMC flash devices\n", fcnt);
msp_flash = kmalloc(fcnt * sizeof(struct map_info *), GFP_KERNEL);
msp_parts = kmalloc(fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
- msp_maps = kmalloc(fcnt * sizeof(struct mtd_info), GFP_KERNEL);
- memset(msp_maps, 0, fcnt * sizeof(struct mtd_info));
+ msp_maps = kcalloc(fcnt, sizeof(struct mtd_info), GFP_KERNEL);
/* loop over the flash devices, initializing each */
for (i = 0; i < fcnt; i++) {
@@ -92,9 +91,8 @@ int __init init_msp_flash(void)
continue;
}
- msp_parts[i] = kmalloc(pcnt * sizeof(struct mtd_partition),
+ msp_parts[i] = kcalloc(pcnt, sizeof(struct mtd_partition),
GFP_KERNEL);
- memset(msp_parts[i], 0, pcnt * sizeof(struct mtd_partition));
/* now initialize the devices proper */
flash_name[5] = '0' + i;
More information about the linux-mtd
mailing list