diff options
Diffstat (limited to 'drivers/mtd/maps/physmap_of.c')
-rw-r--r-- | drivers/mtd/maps/physmap_of.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index f223f3fec3af..e828d58910f0 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -205,7 +205,7 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
205 | dev_err(&dev->dev, "Malformed reg property on %s\n", | 205 | dev_err(&dev->dev, "Malformed reg property on %s\n", |
206 | dev->node->full_name); | 206 | dev->node->full_name); |
207 | err = -EINVAL; | 207 | err = -EINVAL; |
208 | goto err_out; | 208 | goto err_flash_remove; |
209 | } | 209 | } |
210 | count /= reg_tuple_size; | 210 | count /= reg_tuple_size; |
211 | 211 | ||
@@ -213,14 +213,14 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
213 | info = kzalloc(sizeof(struct of_flash) + | 213 | info = kzalloc(sizeof(struct of_flash) + |
214 | sizeof(struct of_flash_list) * count, GFP_KERNEL); | 214 | sizeof(struct of_flash_list) * count, GFP_KERNEL); |
215 | if (!info) | 215 | if (!info) |
216 | goto err_out; | 216 | goto err_flash_remove; |
217 | |||
218 | mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL); | ||
219 | if (!info) | ||
220 | goto err_out; | ||
221 | 217 | ||
222 | dev_set_drvdata(&dev->dev, info); | 218 | dev_set_drvdata(&dev->dev, info); |
223 | 219 | ||
220 | mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL); | ||
221 | if (!mtd_list) | ||
222 | goto err_flash_remove; | ||
223 | |||
224 | for (i = 0; i < count; i++) { | 224 | for (i = 0; i < count; i++) { |
225 | err = -ENXIO; | 225 | err = -ENXIO; |
226 | if (of_address_to_resource(dp, i, &res)) { | 226 | if (of_address_to_resource(dp, i, &res)) { |
@@ -339,6 +339,7 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
339 | 339 | ||
340 | err_out: | 340 | err_out: |
341 | kfree(mtd_list); | 341 | kfree(mtd_list); |
342 | err_flash_remove: | ||
342 | of_flash_remove(dev); | 343 | of_flash_remove(dev); |
343 | 344 | ||
344 | return err; | 345 | return err; |