summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/mtd/maps
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/mtd/maps')
-rw-r--r--kernel/drivers/mtd/maps/pmcmsp-flash.c6
-rw-r--r--kernel/drivers/mtd/maps/sa1100-flash.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/kernel/drivers/mtd/maps/pmcmsp-flash.c b/kernel/drivers/mtd/maps/pmcmsp-flash.c
index 744ca5cac..f9fa3fad7 100644
--- a/kernel/drivers/mtd/maps/pmcmsp-flash.c
+++ b/kernel/drivers/mtd/maps/pmcmsp-flash.c
@@ -75,15 +75,15 @@ static 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_flash = kcalloc(fcnt, sizeof(*msp_flash), GFP_KERNEL);
if (!msp_flash)
return -ENOMEM;
- msp_parts = kmalloc(fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
+ msp_parts = kcalloc(fcnt, sizeof(*msp_parts), GFP_KERNEL);
if (!msp_parts)
goto free_msp_flash;
- msp_maps = kcalloc(fcnt, sizeof(struct mtd_info), GFP_KERNEL);
+ msp_maps = kcalloc(fcnt, sizeof(*msp_maps), GFP_KERNEL);
if (!msp_maps)
goto free_msp_parts;
diff --git a/kernel/drivers/mtd/maps/sa1100-flash.c b/kernel/drivers/mtd/maps/sa1100-flash.c
index 142fc3d79..784c6e1a0 100644
--- a/kernel/drivers/mtd/maps/sa1100-flash.c
+++ b/kernel/drivers/mtd/maps/sa1100-flash.c
@@ -230,8 +230,10 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev,
info->mtd = mtd_concat_create(cdev, info->num_subdev,
plat->name);
- if (info->mtd == NULL)
+ if (info->mtd == NULL) {
ret = -ENXIO;
+ goto err;
+ }
}
info->mtd->dev.parent = &pdev->dev;