diff options
-rw-r--r-- | drivers/mtd/maps/physmap_of.c | 8 |
1 files changed, 3 insertions, 5 deletions
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) | |||
68 | kfree(info->list[i].res); | 68 | kfree(info->list[i].res); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | |||
72 | kfree(info); | ||
73 | |||
74 | return 0; | 71 | return 0; |
75 | } | 72 | } |
76 | 73 | ||
@@ -199,8 +196,9 @@ static int of_flash_probe(struct platform_device *dev) | |||
199 | map_indirect = of_property_read_bool(dp, "no-unaligned-direct-access"); | 196 | map_indirect = of_property_read_bool(dp, "no-unaligned-direct-access"); |
200 | 197 | ||
201 | err = -ENOMEM; | 198 | err = -ENOMEM; |
202 | info = kzalloc(sizeof(struct of_flash) + | 199 | info = devm_kzalloc(&dev->dev, |
203 | sizeof(struct of_flash_list) * count, GFP_KERNEL); | 200 | sizeof(struct of_flash) + |
201 | sizeof(struct of_flash_list) * count, GFP_KERNEL); | ||
204 | if (!info) | 202 | if (!info) |
205 | goto err_flash_remove; | 203 | goto err_flash_remove; |
206 | 204 | ||