mtd: physmap_of: Convert device allocation to managed devm_kzalloc()
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Fri, 25 Jan 2013 14:50:27 +0000 (11:50 -0300)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 12 Feb 2013 16:10:46 +0000 (18:10 +0200)
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/maps/physmap_of.c

index 263d9e1..500d7f4 100644 (file)
@@ -68,9 +68,6 @@ static int of_flash_remove(struct platform_device *dev)
                        kfree(info->list[i].res);
                }
        }
-
-       kfree(info);
-
        return 0;
 }
 
@@ -199,8 +196,9 @@ static int of_flash_probe(struct platform_device *dev)
        map_indirect = of_property_read_bool(dp, "no-unaligned-direct-access");
 
        err = -ENOMEM;
-       info = kzalloc(sizeof(struct of_flash) +
-                      sizeof(struct of_flash_list) * count, GFP_KERNEL);
+       info = devm_kzalloc(&dev->dev,
+                           sizeof(struct of_flash) +
+                           sizeof(struct of_flash_list) * count, GFP_KERNEL);
        if (!info)
                goto err_flash_remove;