From: Huang Shijie <b32955@freescale.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
computersforpeace@gmail.com, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: gpmi: Use devm_kzalloc()
Date: Tue, 5 Nov 2013 10:49:06 +0800 [thread overview]
Message-ID: <52785CA2.2090501@freescale.com> (raw)
In-Reply-To: <1383617225-8504-1-git-send-email-festevam@gmail.com>
于 2013年11月05日 10:07, Fabio Estevam 写道:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Using devm_kzalloc() can make the code simpler.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 7ac2280..4b6d802 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -1732,7 +1732,7 @@ static int gpmi_nand_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> - this = kzalloc(sizeof(*this), GFP_KERNEL);
> + this = devm_kzalloc(&pdev->dev, sizeof(*this), GFP_KERNEL);
> if (!this) {
> pr_err("Failed to allocate per-device memory\n");
> return -ENOMEM;
> @@ -1762,7 +1762,6 @@ exit_nfc_init:
> release_resources(this);
> exit_acquire_resources:
> dev_err(this->dev, "driver registration failed: %d\n", ret);
> - kfree(this);
>
> return ret;
> }
> @@ -1773,7 +1772,6 @@ static int gpmi_nand_remove(struct platform_device *pdev)
>
> gpmi_nfc_exit(this);
> release_resources(this);
> - kfree(this);
> return 0;
> }
>
thanks!
Acked-by: Huang Shijie <b32955@freescale.com>
next prev parent reply other threads:[~2013-11-05 2:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 2:07 [PATCH] mtd: gpmi: Use devm_kzalloc() Fabio Estevam
2013-11-05 2:49 ` Huang Shijie [this message]
2013-11-07 18:40 ` Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52785CA2.2090501@freescale.com \
--to=b32955@freescale.com \
--cc=computersforpeace@gmail.com \
--cc=fabio.estevam@freescale.com \
--cc=festevam@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.