aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/sa1100-flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps/sa1100-flash.c')
-rw-r--r--drivers/mtd/maps/sa1100-flash.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 784c6e1a0391..fd5fe12d7461 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -221,7 +221,14 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev,
221 info->mtd = info->subdev[0].mtd; 221 info->mtd = info->subdev[0].mtd;
222 ret = 0; 222 ret = 0;
223 } else if (info->num_subdev > 1) { 223 } else if (info->num_subdev > 1) {
224 struct mtd_info *cdev[nr]; 224 struct mtd_info **cdev;
225
226 cdev = kmalloc_array(nr, sizeof(*cdev), GFP_KERNEL);
227 if (!cdev) {
228 ret = -ENOMEM;
229 goto err;
230 }
231
225 /* 232 /*
226 * We detected multiple devices. Concatenate them together. 233 * We detected multiple devices. Concatenate them together.
227 */ 234 */
@@ -230,6 +237,7 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev,
230 237
231 info->mtd = mtd_concat_create(cdev, info->num_subdev, 238 info->mtd = mtd_concat_create(cdev, info->num_subdev,
232 plat->name); 239 plat->name);
240 kfree(cdev);
233 if (info->mtd == NULL) { 241 if (info->mtd == NULL) {
234 ret = -ENXIO; 242 ret = -ENXIO;
235 goto err; 243 goto err;