mtd: physmap_of: fix incorrect check
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Sep 4 04:59:04 EDT 2009
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=ad4fbc7921bd7cca108ecc1340a014e91ecc8536
Commit: ad4fbc7921bd7cca108ecc1340a014e91ecc8536
Parent: 9a73290d7735c0671d1d2379ed40025db8b773d0
Author: vimal singh <vimal.newwork at gmail.com>
AuthorDate: Thu Jul 30 20:54:27 2009 +0530
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Sep 4 09:39:50 2009 +0100
mtd: physmap_of: fix incorrect check
This patch fixes a spelling error that has resulted from copy and
pasting. The location of the error was found using a semantic patch
but the semantic patch was not trying to find these errors. After
looking things over it seemed logical that this change was needed.
The patch also makes sure mtd_list is not being freed if it has not
been allocated
Signed-off-by: Stoyan Gaydarov <sgayda2 at uiuc.edu>
Signed-off-by: Vimal Singh <vimalsingh at ti.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
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 f223f3f..e828d58 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,
dev_err(&dev->dev, "Malformed reg property on %s\n",
dev->node->full_name);
err = -EINVAL;
- goto err_out;
+ goto err_flash_remove;
}
count /= reg_tuple_size;
@@ -213,14 +213,14 @@ static int __devinit of_flash_probe(struct of_device *dev,
info = kzalloc(sizeof(struct of_flash) +
sizeof(struct of_flash_list) * count, GFP_KERNEL);
if (!info)
- goto err_out;
-
- mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL);
- if (!info)
- goto err_out;
+ goto err_flash_remove;
dev_set_drvdata(&dev->dev, info);
+ mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL);
+ if (!mtd_list)
+ goto err_flash_remove;
+
for (i = 0; i < count; i++) {
err = -ENXIO;
if (of_address_to_resource(dp, i, &res)) {
@@ -339,6 +339,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
err_out:
kfree(mtd_list);
+err_flash_remove:
of_flash_remove(dev);
return err;
More information about the linux-mtd-cvs
mailing list