diff mbox

[1/2] mtd: physmap_of: Convert device allocation to managed devm_kzalloc()

Message ID 1359125428-23801-2-git-send-email-ezequiel.garcia@free-electrons.com
State Accepted
Commit eb82038f97f93c5f0ff274fb98a9fff741dc2f5e
Headers show

Commit Message

Ezequiel Garcia Jan. 25, 2013, 2:50 p.m. UTC
Tested by compilation only.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/mtd/maps/physmap_of.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Comments

Ezequiel Garcia Feb. 4, 2013, 12:36 p.m. UTC | #1
Artem,

On Fri, Jan 25, 2013 at 11:50 AM, Ezequiel Garcia
<ezequiel.garcia@free-electrons.com> wrote:
> Tested by compilation only.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
>  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 67cc73c..c69e5c4 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;
>
> --
> 1.7.8.6
>

I've just tested this physmap series.
Can you pick only this one?

The other two depend on the devm_ioremap_resource() patch,
so I'll re-submit them when that patch hits your tree.

Thanks,
Artem Bityutskiy Feb. 12, 2013, 4:10 p.m. UTC | #2
On Fri, 2013-01-25 at 11:50 -0300, Ezequiel Garcia wrote:
> Tested by compilation only.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Pushed this one to l2-mtd.git, thanks!
diff mbox

Patch

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 67cc73c..c69e5c4 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;