Skip to content

Commit

Permalink
mtd: physmap_of: fix incorrect check
Browse files Browse the repository at this point in the history
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@uiuc.edu>
Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
vimal singh authored and David Woodhouse committed Sep 4, 2009
1 parent 9a73290 commit ad4fbc7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/mtd/maps/physmap_of.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,22 +205,22 @@ 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;

err = -ENOMEM;
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)) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ad4fbc7

Please sign in to comment.