From: Ezequiel Garcia Date: Fri, 25 Jan 2013 14:50:27 +0000 (-0300) Subject: mtd: physmap_of: Convert device allocation to managed devm_kzalloc() X-Git-Tag: firefly_0821_release~3680^2~971^2~4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=eb82038f97f93c5f0ff274fb98a9fff741dc2f5e;p=firefly-linux-kernel-4.4.55.git mtd: physmap_of: Convert device allocation to managed devm_kzalloc() Signed-off-by: Ezequiel Garcia Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 263d9e1b8001..500d7f4f8028 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -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;