From: Lars-Peter Clausen <lars@metafoo.de>
To: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Cc: cbou@mail.ru, dwmw2@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] Use devm_kzalloc instead of kzalloc/kfree
Date: Fri, 19 Oct 2012 11:21:41 +0200 [thread overview]
Message-ID: <50811BA5.8000004@metafoo.de> (raw)
In-Reply-To: <1350603664-18148-2-git-send-email-marcos.souza.org@gmail.com>
On 10/19/2012 01:41 AM, Marcos Paulo de Souza wrote:
> This does not chnange the rationale, just a cleanup
>
> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Thanks,
Acked-by: Lars-Peter Clausen <lars@metafoo.de?
> ---
> drivers/power/jz4740-battery.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c
> index 8dbc7bf..72f6335 100644
> --- a/drivers/power/jz4740-battery.c
> +++ b/drivers/power/jz4740-battery.c
> @@ -252,7 +252,7 @@ static int __devinit jz_battery_probe(struct platform_device *pdev)
> return -ENXIO;
> }
>
> - jz_battery = kzalloc(sizeof(*jz_battery), GFP_KERNEL);
> + jz_battery = devm_kzalloc(&pdev->dev, sizeof(*jz_battery), GFP_KERNEL);
> if (!jz_battery) {
> dev_err(&pdev->dev, "Failed to allocate driver structure\n");
> return -ENOMEM;
> @@ -264,14 +264,14 @@ static int __devinit jz_battery_probe(struct platform_device *pdev)
> if (jz_battery->irq < 0) {
> ret = jz_battery->irq;
> dev_err(&pdev->dev, "Failed to get platform irq: %d\n", ret);
> - goto err_free;
> + goto err;
> }
>
> jz_battery->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!jz_battery->mem) {
> ret = -ENOENT;
> dev_err(&pdev->dev, "Failed to get platform mmio resource\n");
> - goto err_free;
> + goto err;
> }
>
> jz_battery->mem = request_mem_region(jz_battery->mem->start,
> @@ -279,7 +279,7 @@ static int __devinit jz_battery_probe(struct platform_device *pdev)
> if (!jz_battery->mem) {
> ret = -EBUSY;
> dev_err(&pdev->dev, "Failed to request mmio memory region\n");
> - goto err_free;
> + goto err;
> }
>
> jz_battery->base = ioremap_nocache(jz_battery->mem->start,
> @@ -373,8 +373,7 @@ err_iounmap:
> iounmap(jz_battery->base);
> err_release_mem_region:
> release_mem_region(jz_battery->mem->start, resource_size(jz_battery->mem));
> -err_free:
> - kfree(jz_battery);
> +err:
> return ret;
> }
>
> @@ -396,7 +395,6 @@ static int __devexit jz_battery_remove(struct platform_device *pdev)
>
> iounmap(jz_battery->base);
> release_mem_region(jz_battery->mem->start, resource_size(jz_battery->mem));
> - kfree(jz_battery);
>
> return 0;
> }
next prev parent reply other threads:[~2012-10-19 9:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-18 23:41 [PATCH 0/4] driver/power/jz4740-battery: driver cleanup Marcos Paulo de Souza
2012-10-18 23:41 ` [PATCH 1/4] Use devm_kzalloc instead of kzalloc/kfree Marcos Paulo de Souza
2012-10-19 9:21 ` Lars-Peter Clausen [this message]
2012-10-18 23:41 ` [PATCH 2/4] Use devm_* for request_mem_region and ioremap Marcos Paulo de Souza
2012-10-19 9:25 ` Lars-Peter Clausen
2012-10-18 23:41 ` [PATCH 3/4] Use devm_request_irq to avoid some checks Marcos Paulo de Souza
2012-10-19 9:44 ` Lars-Peter Clausen
2012-10-19 14:44 ` Marcos Souza
2012-10-19 16:05 ` Lars-Peter Clausen
2012-10-18 23:41 ` [PATCH 4/4] power/jz4740.c: Simplify exit of function Marcos Paulo de Souza
2012-10-19 12:15 ` Lars-Peter Clausen
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=50811BA5.8000004@metafoo.de \
--to=lars@metafoo.de \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcos.souza.org@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome