From: Evgeniy Polyakov <zbr@ioremap.net>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drivers/w1/masters/mxc_w1.c: use devm_ functions
Date: Wed, 12 Dec 2012 01:25:56 +0400 [thread overview]
Message-ID: <20121211212555.GA15333@ioremap.net> (raw)
In-Reply-To: <1354835724-26945-2-git-send-email-Julia.Lawall@lip6.fr>
Hi
On Fri, Dec 07, 2012 at 12:15:24AM +0100, Julia Lawall (Julia.Lawall@lip6.fr) wrote:
> + mdev = devm_kzalloc(&pdev->dev, sizeof(struct mxc_w1_device),
> + GFP_KERNEL);
> if (!mdev)
> return -ENOMEM;
>
> - mdev->clk = clk_get(&pdev->dev, NULL);
> - if (IS_ERR(mdev->clk)) {
> - err = PTR_ERR(mdev->clk);
> - goto failed_clk;
> - }
> + mdev->clk = devm_clk_get(&pdev->dev, NULL);
> + if (IS_ERR(mdev->clk))
> + return PTR_ERR(mdev->clk);
>
> mdev->clkdiv = (clk_get_rate(mdev->clk) / 1000000) - 1;
>
> - res = request_mem_region(res->start, resource_size(res),
> - "mxc_w1");
> - if (!res) {
> - err = -EBUSY;
> - goto failed_req;
> - }
> -
> - mdev->regs = ioremap(res->start, resource_size(res));
> - if (!mdev->regs) {
> - dev_err(&pdev->dev, "Cannot map mxc_w1 registers\n");
> - goto failed_ioremap;
> - }
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + mdev->regs = devm_request_and_ioremap(&pdev->dev, res);
> + if (!mdev->regs)
> + return -EBUSY;
I suppose mdev will be automatically freed, but who will release
mdev->clk and other private members of mdev structure?
--
Evgeniy Polyakov
next prev parent reply other threads:[~2012-12-11 21:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-06 23:15 [PATCH 1/2] drivers/w1/masters/mxc_w1.c: use devm_ functions Julia Lawall
2012-12-11 21:25 ` Evgeniy Polyakov [this message]
2012-12-13 9:39 ` Dan Carpenter
2012-12-13 10:18 ` Julia Lawall
2012-12-13 11:20 ` Dan Carpenter
2012-12-13 11:23 ` Julia Lawall
2012-12-13 18:27 ` Evgeniy Polyakov
2012-12-13 18:28 ` Evgeniy Polyakov
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=20121211212555.GA15333@ioremap.net \
--to=zbr@ioremap.net \
--cc=Julia.Lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox