Commit 4fb4caa6 authored by Mariusz Kozlowski's avatar Mariusz Kozlowski Committed by David Woodhouse

[MTD] pmcmsp-flash.c: kmalloc + memset conversion to k[cz]alloc

Signed-off-by: default avatarMariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 40562f81
...@@ -73,13 +73,16 @@ int __init init_msp_flash(void) ...@@ -73,13 +73,16 @@ int __init init_msp_flash(void)
return -ENXIO; return -ENXIO;
printk(KERN_NOTICE "Found %d PMC flash devices\n", fcnt); printk(KERN_NOTICE "Found %d PMC flash devices\n", fcnt);
msp_flash = (struct mtd_info **)kmalloc(
fcnt * sizeof(struct map_info *), GFP_KERNEL); msp_flash = kmalloc(fcnt * sizeof(struct map_info *), GFP_KERNEL);
msp_parts = (struct mtd_partition **)kmalloc( msp_parts = kmalloc(fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
fcnt * sizeof(struct mtd_partition *), GFP_KERNEL); msp_maps = kcalloc(fcnt, sizeof(struct mtd_info), GFP_KERNEL);
msp_maps = (struct map_info *)kmalloc( if (!msp_flash || !msp_parts || !msp_maps) {
fcnt * sizeof(struct mtd_info), GFP_KERNEL); kfree(msp_maps);
memset(msp_maps, 0, fcnt * sizeof(struct mtd_info)); kfree(msp_parts);
kfree(msp_flash);
return -ENOMEM;
}
/* loop over the flash devices, initializing each */ /* loop over the flash devices, initializing each */
for (i = 0; i < fcnt; i++) { for (i = 0; i < fcnt; i++) {
...@@ -95,9 +98,8 @@ int __init init_msp_flash(void) ...@@ -95,9 +98,8 @@ int __init init_msp_flash(void)
continue; continue;
} }
msp_parts[i] = (struct mtd_partition *)kmalloc( msp_parts[i] = kcalloc(pcnt, sizeof(struct mtd_partition),
pcnt * sizeof(struct mtd_partition), GFP_KERNEL); GFP_KERNEL);
memset(msp_parts[i], 0, pcnt * sizeof(struct mtd_partition));
/* now initialize the devices proper */ /* now initialize the devices proper */
flash_name[5] = '0' + i; flash_name[5] = '0' + i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment